QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#89196#5252. DeforestationwhateverWA 4ms3896kbC++141.0kb2023-03-19 11:06:132023-03-19 11:06:17

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-19 11:06:17]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3896kb
  • [2023-03-19 11:06:13]
  • 提交

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
*/

详细

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: ''