QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#595727#5253. Denormalizationhzy99999#WA 0ms3840kbC++201.4kb2024-09-28 14:20:482024-09-28 14:20:48

Judging History

This is the latest submission verdict.

  • [2024-09-28 14:20:48]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3840kb
  • [2024-09-28 14:20:48]
  • Submitted

answer

#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
const int N = 1e4 + 10;
const double eps = 1e-8;
typedef long long LL;
int n;
double a[10010];
vector<int> res;
int dcmp(double a, double b)
{
    if (fabs(a - b) < eps)
        return 0;
    if (a < b)
        return -1;
    return 1;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    double mn = 1, ma = 0;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        mn = min(mn, a[i]);
        ma = max(ma, a[i]);
    }
    auto check = [&](int x) -> bool
    {
        res.clear();
        double d = x / mn;
        double ans = 0;
        for (int i = 1; i <= n; i++)
        {
            double t0 = a[i] * d;
            int t1 = t0, t2 = t1 + 1;
            int t = 0;
            if (!dcmp(t1, t0))
                t = t1;
            else if (!dcmp(t2, t0))
                t = t2;
            else
                return 0;
            res.push_back(t);
            ans += t * t;
        }
        return !dcmp(ans, d * d);
    };
    for (int i = 1; i <= 10000; i++)
    {
        if (dcmp(i / mn * ma, 10000) >= 0)
            break;
        if (check(i))
        {
            for (int i = 0; i < n; i++)
                cout << res[i] << '\n';
            break;
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3840kb

input:

2
0.909840249060
0.414958698174

output:


result:

wrong output format Unexpected end of file - int32 expected