結果
| 問題 | No.1665 quotient replace |
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2021-09-03 22:33:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 177 ms / 3,000 ms |
| コード長 | 967 bytes |
| 記録 | |
| コンパイル時間 | 2,121 ms |
| コンパイル使用メモリ | 194,184 KB |
| 最終ジャッジ日時 | 2025-01-24 06:23:16 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 |
ソースコード
#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;
}
umezo