QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#96161#5253. Denormalization8BQube#WA 1ms3404kbC++171.4kb2023-04-13 14:53:492023-04-13 14:53:51

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-13 14:53:51]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3404kb
  • [2023-04-13 14:53:49]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define X first
#define Y second
#define SZ(a) ((int)a.size())
#define ALL(v) v.begin(), v.end()
#define pb push_back

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    vector<string> org, vec;
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        string s;
        cin >> s;
        vec.pb(s);
    }
    org = vec;
    vector<pair<double, int>> arr;
    sort(ALL(vec));
    arr.pb(make_pair(stold(vec[0]), 1));
    for (int i = 1; i < n; ++i)
        if (vec[i] == vec[i - 1])
            arr.back().Y++;
        else
            arr.pb(make_pair(stold(vec[i]), 1));
    const int C = 10000;
    const double eps = 1e-2;
    for (int i = 1; i <= C; ++i) {
        int flag = 1;
        double d = i / arr[0].X;
        //if (fabsl(d * d - round(d * d)) > eps) continue;
        ll sum = 0;
        for (int j = SZ(arr) - 1; j >= 0; --j) {
            double nv = d * arr[j].X;
            if (fabsl(nv - round(nv)) > eps) {
                flag = 0;
                break;
            }
            ll fin = ll(round(nv));
            sum += fin * fin * arr[j].Y;
        }
        if (!flag) continue;
        //if (!flag || (ll)round(d * d) != sum) continue;
        for (int j = 0; j < n; ++j) {
            cout << (ll)round(stold(org[j]) * d) << "\n";
        }
        return 0;
    }
    assert(0);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3404kb

input:

2
0.909840249060
0.414958698174

output:

57
26

result:

wrong answer incorrect solution