結果

問題 No.1665 quotient replace
ユーザー eSeF
提出日時 2021-09-14 21:53:26
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 550 bytes
コンパイル時間 6,795 ms
コンパイル使用メモリ 179,584 KB
実行使用メモリ 11,180 KB
最終ジャッジ日時 2024-06-27 13:25:05
合計ジャッジ時間 15,225 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30 WA * 11
権限があれば一括ダウンロードができます

ソースコード

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);
  int g = 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, c = 0;
      while(y%i==0)y/=i,c++;
      g^=c;
    }
  }
  cout << (g?"white":"black") << endl;
  return 0;
}
0