結果

問題 No.1881 Everything is the same...
ユーザー SSRSSSRS
提出日時 2022-03-18 22:38:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 772 bytes
コンパイル時間 4,023 ms
コンパイル使用メモリ 196,592 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-14 10:35:39
合計ジャッジ時間 4,279 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,940 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 3 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 4 ms
6,940 KB
testcase_12 WA -
testcase_13 AC 7 ms
6,940 KB
testcase_14 AC 8 ms
6,940 KB
testcase_15 AC 7 ms
6,940 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 8 ms
6,944 KB
testcase_21 AC 7 ms
6,944 KB
testcase_22 WA -
testcase_23 AC 8 ms
6,940 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 8 ms
6,940 KB
testcase_28 AC 8 ms
6,940 KB
testcase_29 WA -
testcase_30 AC 7 ms
6,944 KB
testcase_31 AC 7 ms
6,940 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 7 ms
6,940 KB
testcase_35 WA -
testcase_36 AC 7 ms
6,940 KB
testcase_37 AC 7 ms
6,944 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 7 ms
6,940 KB
testcase_42 AC 3 ms
6,940 KB
testcase_43 AC 3 ms
6,940 KB
testcase_44 AC 3 ms
6,944 KB
testcase_45 AC 3 ms
6,940 KB
testcase_46 AC 3 ms
6,944 KB
testcase_47 AC 3 ms
6,940 KB
testcase_48 WA -
testcase_49 AC 3 ms
6,944 KB
testcase_50 WA -
testcase_51 AC 3 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const int MAX = 100000;
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  vector<int> pr(MAX + 1, -1);
  for (int i = 2; i <= MAX; i++){
    if (pr[i] == -1){
      for (int j = i; j <= MAX; j += i){
        pr[j] = i;
      }
    }
  }
  vector<int> B(N, 1);
  for (int i = 0; i < N; i++){
    while (A[i] > 1){
      int p = pr[A[i]];
      int X = 1;
      while (A[i] % p == 0){
        A[i] /= p;
        X *= p;
      }
      B[i] *= X / p * (p - 1);
    }
  }
  int cnt = 0;
  for (int i = 0; i < N; i++){
    while (B[i] > 1){
      B[i] /= pr[B[i]];
      cnt++;
    }
  }
  if (cnt % 2 == 0){
    cout << 'X' << endl;
  } else {
    cout << 'Y' << endl;
  }
}
0