結果

問題 No.1665 quotient replace
ユーザー shiroha_F14shiroha_F14
提出日時 2021-08-09 21:05:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 395 ms / 3,000 ms
コード長 622 bytes
コンパイル時間 1,683 ms
コンパイル使用メモリ 169,256 KB
実行使用メモリ 14,988 KB
最終ジャッジ日時 2024-05-09 00:36:45
合計ジャッジ時間 10,673 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
7,080 KB
testcase_01 AC 13 ms
7,168 KB
testcase_02 AC 11 ms
7,124 KB
testcase_03 AC 13 ms
7,168 KB
testcase_04 AC 12 ms
7,156 KB
testcase_05 AC 12 ms
7,264 KB
testcase_06 AC 15 ms
7,168 KB
testcase_07 AC 13 ms
7,096 KB
testcase_08 AC 14 ms
7,124 KB
testcase_09 AC 23 ms
7,372 KB
testcase_10 AC 141 ms
9,788 KB
testcase_11 AC 299 ms
13,056 KB
testcase_12 AC 43 ms
7,808 KB
testcase_13 AC 390 ms
14,968 KB
testcase_14 AC 389 ms
14,916 KB
testcase_15 AC 395 ms
14,988 KB
testcase_16 AC 384 ms
14,928 KB
testcase_17 AC 384 ms
14,928 KB
testcase_18 AC 12 ms
7,060 KB
testcase_19 AC 11 ms
7,204 KB
testcase_20 AC 11 ms
7,124 KB
testcase_21 AC 11 ms
7,128 KB
testcase_22 AC 12 ms
7,296 KB
testcase_23 AC 11 ms
7,124 KB
testcase_24 AC 11 ms
7,108 KB
testcase_25 AC 11 ms
7,196 KB
testcase_26 AC 12 ms
7,200 KB
testcase_27 AC 14 ms
7,128 KB
testcase_28 AC 22 ms
7,408 KB
testcase_29 AC 33 ms
7,672 KB
testcase_30 AC 173 ms
11,236 KB
testcase_31 AC 257 ms
13,172 KB
testcase_32 AC 282 ms
12,768 KB
testcase_33 AC 113 ms
9,216 KB
testcase_34 AC 230 ms
11,712 KB
testcase_35 AC 211 ms
11,264 KB
testcase_36 AC 218 ms
11,540 KB
testcase_37 AC 201 ms
11,168 KB
testcase_38 AC 240 ms
11,916 KB
testcase_39 AC 172 ms
10,396 KB
testcase_40 AC 172 ms
10,396 KB
testcase_41 AC 170 ms
10,400 KB
testcase_42 AC 11 ms
7,064 KB
testcase_43 AC 12 ms
7,140 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