結果
| 問題 |
No.1665 quotient replace
|
| コンテスト | |
| ユーザー |
shiroha_F14
|
| 提出日時 | 2021-08-09 20:06:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 616 bytes |
| コンパイル時間 | 1,482 ms |
| コンパイル使用メモリ | 169,292 KB |
| 実行使用メモリ | 15,072 KB |
| 最終ジャッジ日時 | 2024-12-15 08:47:45 |
| 合計ジャッジ時間 | 12,593 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 RE * 37 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
int n; cin >> n;
vector<int> a(n);
for(int i = 0; i < n; i++) cin >> a[i];
vector<int> spl(1000001, 0);
spl[1] = 1;
for(int i = 2; i <= 1000; i++){
if(spl[i]) continue;
for(int j = i; j <= 1000000; j += i){
spl[j] = i;
}
}
vector<int> grundy(n);
for(int i = 0; i < n; i++){
while(a[i] > 1){
a[i] /= spl[a[i]];
grundy[i]++;
}
}
// all xor
int nimber = 0;
for(int i = 0; i < n; i++){
nimber = nimber ^ grundy[i];
}
cout << (nimber ? "white" : "black") << endl;
}
shiroha_F14