QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#89196 | #5252. Deforestation | whatever | WA | 4ms | 3896kb | C++14 | 1.0kb | 2023-03-19 11:06:13 | 2023-03-19 11:06:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e4 + 5;
int n, a[N];
long double x[N];
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef ALEX_WEI
FILE* IN = freopen("1.in", "r", stdin);
FILE* OUT = freopen("1.out", "w", stdout);
#endif
cin >> n;
for(int i = 1; i <= n; i++) cin >> x[i];
for(int i = 1; i <= 10000; i++) {
long double d = i / x[1];
for(int j = 1; j <= n; j++) {
long double c = x[j] * d + 1e-6;
a[j] = (int) c;
}
int gcd = a[1];
for(int j = 2; j <= n; j++) gcd = __gcd(gcd, a[j]);
if(gcd != 1) continue;
long double tot = 0;
for(int j = 1; j <= n; j++) tot += a[j] * a[j];
tot = sqrt(tot);
bool ok = 1;
for(int j = 1; j <= n; j++) ok &= abs(a[j] / tot - x[j]) < 1e-6;
if(!ok) continue;
for(int j = 1; j <= n; j++) cout << a[j] << "\n";
exit(0);
}
cerr << 1e3 * clock() / CLOCKS_PER_SEC << " ms\n";
return 0;
}
/*
g++ E.cpp -o E -std=c++14 -O2 -DALEX_WEI
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 4ms
memory: 3896kb
input:
999900000 7339 3 14947 2 12850 3 8986 10 11599 9 8889 10 10711 4 8015 1 11626 0 9492 1 7017 0 8863 0 8632 0 5321 5 9906 0 11687 0 9845 0 10469 0 11708 0 14950 5 11934 0 11922 0 13101 0 12000 0 9082 0 9273 5 12296 0 6119 0 9201 0 12652 0 12957 0 7454 5 12515 0 12976 0 10358 0 13997 0 8371 0 10181 5 8...
output:
result:
wrong answer 1st lines differ - expected: '1', found: ''