結果

問題 No.1665 quotient replace
ユーザー umezoumezo
提出日時 2021-09-03 22:33:31
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 188 ms / 3,000 ms
コード長 967 bytes
コンパイル時間 1,940 ms
コンパイル使用メモリ 199,844 KB
実行使用メモリ 11,080 KB
最終ジャッジ日時 2023-08-21 23:21:12
合計ジャッジ時間 6,972 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
6,780 KB
testcase_01 AC 8 ms
7,068 KB
testcase_02 AC 8 ms
6,808 KB
testcase_03 AC 8 ms
6,880 KB
testcase_04 AC 8 ms
7,012 KB
testcase_05 AC 8 ms
7,068 KB
testcase_06 AC 9 ms
6,828 KB
testcase_07 AC 8 ms
6,828 KB
testcase_08 AC 9 ms
6,808 KB
testcase_09 AC 14 ms
7,204 KB
testcase_10 AC 68 ms
8,192 KB
testcase_11 AC 137 ms
10,024 KB
testcase_12 AC 22 ms
7,236 KB
testcase_13 AC 182 ms
10,900 KB
testcase_14 AC 179 ms
10,832 KB
testcase_15 AC 182 ms
10,780 KB
testcase_16 AC 188 ms
10,936 KB
testcase_17 AC 185 ms
11,080 KB
testcase_18 AC 8 ms
6,932 KB
testcase_19 AC 8 ms
6,876 KB
testcase_20 AC 8 ms
6,884 KB
testcase_21 AC 8 ms
6,944 KB
testcase_22 AC 8 ms
6,880 KB
testcase_23 AC 8 ms
7,064 KB
testcase_24 AC 8 ms
6,812 KB
testcase_25 AC 8 ms
6,884 KB
testcase_26 AC 8 ms
7,092 KB
testcase_27 AC 9 ms
6,816 KB
testcase_28 AC 11 ms
7,200 KB
testcase_29 AC 15 ms
7,264 KB
testcase_30 AC 57 ms
8,992 KB
testcase_31 AC 83 ms
9,988 KB
testcase_32 AC 137 ms
9,776 KB
testcase_33 AC 56 ms
7,944 KB
testcase_34 AC 110 ms
9,356 KB
testcase_35 AC 102 ms
9,104 KB
testcase_36 AC 107 ms
8,992 KB
testcase_37 AC 112 ms
8,920 KB
testcase_38 AC 114 ms
9,264 KB
testcase_39 AC 84 ms
8,476 KB
testcase_40 AC 84 ms
8,604 KB
testcase_41 AC 83 ms
8,600 KB
testcase_42 AC 9 ms
6,832 KB
testcase_43 AC 8 ms
6,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

const int MAX=1000100;

template<typename T>
vector<T> smallest_prime_factors(T n){
  vector<T> spf(n+1);
  for(int i=0;i<=n;i++) spf[i]=i;

  for(T i=2;i*i<=n;i++){
    if(spf[i]==i){ //素数だったら
      for(T j=i*i;j<=n;j+=i){ 
        if(spf[j]==j) spf[j]=i; //iを持つ整数かつまだ素数が決まっていないなら
      }
    }
  }
  return spf;
}

template<typename T>
int factolization(T x,vector<T> &spf){
  int  ret=0;
  while(x!=1) {
    ret++;
    x/=spf[x];
  }
  return ret;
}
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  auto spf=smallest_prime_factors(MAX);
  
  int n;
  cin>>n;
  vector<int> A(n);
  rep(i,n) cin>>A[i];
  
  int ans=0;
  rep(i,n) ans^=factolization(A[i],spf);
  if(ans==0) cout<<"black"<<endl;
  else cout<<"white"<<endl;
  
  return 0;
}
0