結果

問題 No.1665 quotient replace
ユーザー shiroha_F14shiroha_F14
提出日時 2021-08-25 14:23:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 518 bytes
コンパイル時間 1,704 ms
コンパイル使用メモリ 166,712 KB
実行使用メモリ 15,436 KB
最終ジャッジ日時 2023-08-21 19:00:48
合計ジャッジ時間 12,712 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,764 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 5 ms
4,376 KB
testcase_04 AC 5 ms
4,376 KB
testcase_05 WA -
testcase_06 AC 36 ms
4,380 KB
testcase_07 AC 8 ms
4,376 KB
testcase_08 AC 21 ms
4,380 KB
testcase_09 AC 135 ms
4,376 KB
testcase_10 AC 1,483 ms
5,648 KB
testcase_11 TLE -
testcase_12 AC 362 ms
4,376 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます

ソースコード

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> grundy(n, 0);
  for(int i = 0; i < n; i++){
    int p = a[i];
    for(int j = 2; j <= ceil(sqrt(a[i])); j++){
      while(p % j == 0){
        p /= j;
        grundy[i]++;
      }
    }
  }
  
  // all xor
  int nimber = 0;
  for(int i = 0; i < n; i++){
    nimber = nimber ^ grundy[i];
  }
  cout << (nimber ? "white" : "black") << endl;
}
0