結果

問題 No.1665 quotient replace
ユーザー monnumonnu
提出日時 2021-09-03 23:15:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 324 ms / 3,000 ms
コード長 792 bytes
コンパイル時間 4,412 ms
コンパイル使用メモリ 228,720 KB
実行使用メモリ 11,148 KB
最終ジャッジ日時 2024-05-09 07:01:11
合計ジャッジ時間 10,355 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
7,296 KB
testcase_01 AC 12 ms
7,264 KB
testcase_02 AC 13 ms
7,216 KB
testcase_03 AC 12 ms
7,296 KB
testcase_04 AC 13 ms
7,296 KB
testcase_05 AC 12 ms
7,260 KB
testcase_06 AC 15 ms
7,168 KB
testcase_07 AC 13 ms
7,272 KB
testcase_08 AC 13 ms
7,244 KB
testcase_09 AC 22 ms
7,280 KB
testcase_10 AC 117 ms
8,384 KB
testcase_11 AC 248 ms
10,184 KB
testcase_12 AC 38 ms
7,420 KB
testcase_13 AC 322 ms
10,968 KB
testcase_14 AC 322 ms
11,124 KB
testcase_15 AC 323 ms
11,148 KB
testcase_16 AC 324 ms
11,108 KB
testcase_17 AC 323 ms
11,104 KB
testcase_18 AC 12 ms
7,100 KB
testcase_19 AC 12 ms
7,104 KB
testcase_20 AC 13 ms
7,296 KB
testcase_21 AC 13 ms
7,296 KB
testcase_22 AC 12 ms
7,296 KB
testcase_23 AC 12 ms
7,212 KB
testcase_24 AC 13 ms
7,064 KB
testcase_25 AC 12 ms
7,260 KB
testcase_26 AC 13 ms
7,296 KB
testcase_27 AC 15 ms
7,296 KB
testcase_28 AC 22 ms
7,412 KB
testcase_29 AC 33 ms
7,456 KB
testcase_30 AC 169 ms
9,344 KB
testcase_31 AC 253 ms
10,240 KB
testcase_32 AC 237 ms
9,984 KB
testcase_33 AC 96 ms
8,192 KB
testcase_34 AC 197 ms
9,460 KB
testcase_35 AC 177 ms
9,312 KB
testcase_36 AC 184 ms
9,472 KB
testcase_37 AC 163 ms
9,216 KB
testcase_38 AC 191 ms
9,600 KB
testcase_39 AC 135 ms
8,960 KB
testcase_40 AC 136 ms
9,000 KB
testcase_41 AC 139 ms
8,896 KB
testcase_42 AC 11 ms
7,184 KB
testcase_43 AC 12 ms
7,104 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