結果

問題 No.1881 Everything is the same...
ユーザー SSRSSSRS
提出日時 2022-03-18 23:03:56
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,084 bytes
コンパイル時間 2,105 ms
コンパイル使用メモリ 200,052 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 11:14:22
合計ジャッジ時間 3,791 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 3 ms
6,944 KB
testcase_05 AC 3 ms
6,944 KB
testcase_06 AC 6 ms
6,940 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 4 ms
6,940 KB
testcase_12 AC 8 ms
6,940 KB
testcase_13 AC 8 ms
6,944 KB
testcase_14 AC 8 ms
6,940 KB
testcase_15 AC 8 ms
6,944 KB
testcase_16 AC 8 ms
6,944 KB
testcase_17 AC 8 ms
6,940 KB
testcase_18 AC 8 ms
6,940 KB
testcase_19 AC 8 ms
6,944 KB
testcase_20 AC 8 ms
6,940 KB
testcase_21 AC 8 ms
6,944 KB
testcase_22 AC 8 ms
6,940 KB
testcase_23 AC 8 ms
6,944 KB
testcase_24 AC 9 ms
6,940 KB
testcase_25 AC 8 ms
6,940 KB
testcase_26 AC 8 ms
6,944 KB
testcase_27 AC 8 ms
6,944 KB
testcase_28 AC 8 ms
6,940 KB
testcase_29 AC 8 ms
6,944 KB
testcase_30 AC 8 ms
6,940 KB
testcase_31 AC 8 ms
6,940 KB
testcase_32 WA -
testcase_33 AC 8 ms
6,940 KB
testcase_34 AC 8 ms
6,940 KB
testcase_35 AC 8 ms
6,944 KB
testcase_36 AC 8 ms
6,944 KB
testcase_37 AC 8 ms
6,940 KB
testcase_38 AC 8 ms
6,940 KB
testcase_39 AC 9 ms
6,944 KB
testcase_40 AC 8 ms
6,940 KB
testcase_41 AC 8 ms
6,944 KB
testcase_42 AC 2 ms
6,944 KB
testcase_43 AC 3 ms
6,940 KB
testcase_44 AC 2 ms
6,940 KB
testcase_45 AC 3 ms
6,944 KB
testcase_46 AC 2 ms
6,940 KB
testcase_47 AC 3 ms
6,940 KB
testcase_48 AC 3 ms
6,940 KB
testcase_49 AC 2 ms
6,940 KB
testcase_50 AC 2 ms
6,940 KB
testcase_51 AC 2 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;
  for (int i = 0; i < N; i++){
    while (A[i] > 1){
      int p = pr[A[i]];
      int c = 0;
      while (A[i] % p == 0){
        A[i] /= p;
        c++;
      }
      if (p > 2){
        int X = p - 1;
        for (int j = 0; j < c - 1; j++){
          X *= p;
        }
        B.push_back(X);
      } else {
        if (c >= 2){
          B.push_back(2);
          B.push_back(1 << (c - 2));
        }
      }
    }
  }
  int M = B.size();
  int X = 0;
  for (int i = 0; i < M; i++){
    int cnt = 0;
    while (B[i] > 1){
      int p = pr[B[i]];
      while (B[i] % p == 0){
        B[i] /= p;
        cnt++;
      }
    }
    X ^= cnt;
  }
  if (X == 0){
    cout << 'X' << endl;
  } else {
    cout << 'Y' << endl;
  }
}
0