QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#96161 | #5253. Denormalization | 8BQube# | WA | 1ms | 3404kb | C++17 | 1.4kb | 2023-04-13 14:53:49 | 2023-04-13 14:53:51 |
Judging History
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