結果

問題 No.1665 quotient replace
ユーザー eSeFeSeF
提出日時 2021-09-14 22:03:58
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 430 ms / 3,000 ms
コード長 592 bytes
コンパイル時間 4,842 ms
コンパイル使用メモリ 150,204 KB
実行使用メモリ 14,840 KB
最終ジャッジ日時 2023-09-09 21:06:53
合計ジャッジ時間 14,044 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
14,684 KB
testcase_01 AC 25 ms
14,728 KB
testcase_02 AC 24 ms
14,680 KB
testcase_03 AC 25 ms
14,716 KB
testcase_04 AC 24 ms
14,680 KB
testcase_05 AC 24 ms
14,796 KB
testcase_06 AC 29 ms
14,744 KB
testcase_07 AC 24 ms
14,680 KB
testcase_08 AC 26 ms
14,760 KB
testcase_09 AC 39 ms
14,740 KB
testcase_10 AC 168 ms
14,784 KB
testcase_11 AC 332 ms
14,828 KB
testcase_12 AC 62 ms
14,732 KB
testcase_13 AC 430 ms
14,724 KB
testcase_14 AC 430 ms
14,728 KB
testcase_15 AC 428 ms
14,680 KB
testcase_16 AC 417 ms
14,652 KB
testcase_17 AC 417 ms
14,736 KB
testcase_18 AC 25 ms
14,732 KB
testcase_19 AC 24 ms
14,680 KB
testcase_20 AC 23 ms
14,732 KB
testcase_21 AC 24 ms
14,740 KB
testcase_22 AC 25 ms
14,836 KB
testcase_23 AC 25 ms
14,684 KB
testcase_24 AC 24 ms
14,680 KB
testcase_25 AC 24 ms
14,728 KB
testcase_26 AC 25 ms
14,724 KB
testcase_27 AC 28 ms
14,680 KB
testcase_28 AC 38 ms
14,680 KB
testcase_29 AC 50 ms
14,664 KB
testcase_30 AC 205 ms
14,732 KB
testcase_31 AC 295 ms
14,832 KB
testcase_32 AC 326 ms
14,760 KB
testcase_33 AC 148 ms
14,728 KB
testcase_34 AC 268 ms
14,740 KB
testcase_35 AC 245 ms
14,684 KB
testcase_36 AC 259 ms
14,756 KB
testcase_37 AC 239 ms
14,756 KB
testcase_38 AC 277 ms
14,840 KB
testcase_39 AC 200 ms
14,756 KB
testcase_40 AC 202 ms
14,660 KB
testcase_41 AC 207 ms
14,788 KB
testcase_42 AC 24 ms
14,684 KB
testcase_43 AC 24 ms
14,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
int main(){
  int N;
  cin >> N;
  int M = 1000000;
  vector<int>C(M+1,0);
  for(int i=0;i<N;i++){
    int a;cin >> a;
    C[a]^=1;
  }
  vector<int>p(M+1,1);
  vector<int>gs(M+1,0);
  for(int i=2;i<=M;i++){
    if(p[i]==0)continue;
    for(int j=2*i;j<=M;j+=i){
      p[j] = 0;
    }
    for(int j=i;j<=M;j+=i){
      if(C[j]==0)continue;
      int y = j;
      while(y%i==0)y/=i,gs[j]++;
    }
  }
  int g = 0;
  for(int i=1;i<=M;i++)g^=gs[i];
  cout << (g?"white":"black") << endl;
  return 0;
}
0