結果

問題 No.1665 quotient replace
ユーザー shiroha_F14shiroha_F14
提出日時 2021-08-09 21:05:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 364 ms / 3,000 ms
コード長 622 bytes
コンパイル時間 3,382 ms
コンパイル使用メモリ 165,564 KB
実行使用メモリ 14,780 KB
最終ジャッジ日時 2023-08-21 18:52:48
合計ジャッジ時間 11,301 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,860 KB
testcase_01 AC 11 ms
6,816 KB
testcase_02 AC 11 ms
6,912 KB
testcase_03 AC 11 ms
6,996 KB
testcase_04 AC 11 ms
6,920 KB
testcase_05 AC 11 ms
6,812 KB
testcase_06 AC 14 ms
6,928 KB
testcase_07 AC 11 ms
6,928 KB
testcase_08 AC 13 ms
6,860 KB
testcase_09 AC 22 ms
7,084 KB
testcase_10 AC 128 ms
9,460 KB
testcase_11 AC 278 ms
12,940 KB
testcase_12 AC 39 ms
7,392 KB
testcase_13 AC 362 ms
14,764 KB
testcase_14 AC 364 ms
14,712 KB
testcase_15 AC 361 ms
14,656 KB
testcase_16 AC 361 ms
14,780 KB
testcase_17 AC 358 ms
14,704 KB
testcase_18 AC 11 ms
6,816 KB
testcase_19 AC 12 ms
6,864 KB
testcase_20 AC 11 ms
7,172 KB
testcase_21 AC 11 ms
6,984 KB
testcase_22 AC 11 ms
6,860 KB
testcase_23 AC 11 ms
7,032 KB
testcase_24 AC 11 ms
7,036 KB
testcase_25 AC 11 ms
6,816 KB
testcase_26 AC 12 ms
6,868 KB
testcase_27 AC 13 ms
6,816 KB
testcase_28 AC 21 ms
7,248 KB
testcase_29 AC 31 ms
7,520 KB
testcase_30 AC 158 ms
10,844 KB
testcase_31 AC 234 ms
12,828 KB
testcase_32 AC 267 ms
12,360 KB
testcase_33 AC 106 ms
8,968 KB
testcase_34 AC 215 ms
11,528 KB
testcase_35 AC 197 ms
11,260 KB
testcase_36 AC 210 ms
11,476 KB
testcase_37 AC 189 ms
10,948 KB
testcase_38 AC 228 ms
11,564 KB
testcase_39 AC 160 ms
10,436 KB
testcase_40 AC 161 ms
10,396 KB
testcase_41 AC 161 ms
10,220 KB
testcase_42 AC 11 ms
6,992 KB
testcase_43 AC 11 ms
7,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main(){
  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];

  vector<int> spl(1000001, 0);
  spl[1] = 1;
  for(int i = 2; i <= 1000000; i++){
    if(spl[i]) continue;
    for(int j = i; j <= 1000000; j += i){
      spl[j] = i;
    }
  }

  vector<int> grundy(n);
  for(int i = 0; i < n; i++){
    while(a[i] > 1){
      a[i] /= spl[a[i]];
      grundy[i]++;
    }
  }
  
  // all xor
  int nimber = 0;
  for(int i = 0; i < n; i++){
    nimber = nimber ^ grundy[i];
  }
  cout << (nimber ? "white" : "black") << endl;
}
0