結果

問題 No.1665 quotient replace
ユーザー monnumonnu
提出日時 2021-09-03 23:15:35
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 291 ms / 3,000 ms
コード長 792 bytes
コンパイル時間 3,512 ms
コンパイル使用メモリ 227,532 KB
実行使用メモリ 11,012 KB
最終ジャッジ日時 2023-08-22 01:00:38
合計ジャッジ時間 10,035 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,984 KB
testcase_01 AC 10 ms
6,964 KB
testcase_02 AC 11 ms
7,108 KB
testcase_03 AC 12 ms
6,996 KB
testcase_04 AC 12 ms
7,060 KB
testcase_05 AC 12 ms
7,060 KB
testcase_06 AC 14 ms
7,112 KB
testcase_07 AC 11 ms
7,104 KB
testcase_08 AC 13 ms
7,036 KB
testcase_09 AC 20 ms
6,924 KB
testcase_10 AC 107 ms
8,244 KB
testcase_11 AC 225 ms
9,820 KB
testcase_12 AC 34 ms
7,304 KB
testcase_13 AC 291 ms
10,892 KB
testcase_14 AC 291 ms
10,888 KB
testcase_15 AC 290 ms
10,872 KB
testcase_16 AC 291 ms
11,012 KB
testcase_17 AC 291 ms
10,888 KB
testcase_18 AC 11 ms
7,000 KB
testcase_19 AC 10 ms
7,128 KB
testcase_20 AC 11 ms
7,112 KB
testcase_21 AC 12 ms
7,100 KB
testcase_22 AC 12 ms
6,916 KB
testcase_23 AC 11 ms
6,968 KB
testcase_24 AC 11 ms
6,944 KB
testcase_25 AC 11 ms
7,064 KB
testcase_26 AC 12 ms
6,988 KB
testcase_27 AC 13 ms
7,032 KB
testcase_28 AC 20 ms
6,948 KB
testcase_29 AC 31 ms
7,380 KB
testcase_30 AC 153 ms
9,056 KB
testcase_31 AC 229 ms
10,088 KB
testcase_32 AC 214 ms
10,012 KB
testcase_33 AC 89 ms
8,100 KB
testcase_34 AC 174 ms
9,404 KB
testcase_35 AC 160 ms
9,152 KB
testcase_36 AC 168 ms
9,084 KB
testcase_37 AC 154 ms
8,788 KB
testcase_38 AC 183 ms
9,344 KB
testcase_39 AC 130 ms
8,692 KB
testcase_40 AC 131 ms
8,580 KB
testcase_41 AC 130 ms
8,500 KB
testcase_42 AC 11 ms
7,036 KB
testcase_43 AC 12 ms
6,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<pair<int,int>>>;
#define MAX 100000
#define MOD 1000000007
#define INF 1000000000000000000

int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }

  int M=1000000;
  vector<int> grundy(M+1,0);
  for(int i=2;i*i<=M;i++){
    if(grundy[i]==0){
      for(int d=i;d<=M;d*=i){
        for(int j=d;j<=M;j+=d){
          grundy[j]++;
        }
      }
    }
  }
  for(int i=1001;i<=M;i++){
    if(grundy[i]==0){
      for(int j=i;j<=M;j+=i){
        grundy[j]++;
      }
    }
  }

  int x=0;
  for(int i=0;i<N;i++){
    x^=grundy[A[i]];
  }
  if(x==0){
    cout<<"black"<<'\n';
  }else{
    cout<<"white"<<'\n';
  }
}
0