結果
| 問題 |
No.1665 quotient replace
|
| コンテスト | |
| ユーザー |
nok0
|
| 提出日時 | 2021-08-10 23:11:45 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 493 bytes |
| コンパイル時間 | 1,823 ms |
| コンパイル使用メモリ | 193,760 KB |
| 最終ジャッジ日時 | 2025-01-23 17:26:43 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 2 RE * 39 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int M = 30;
const int S = 100000;
array<bitset<M>, S + 10> mex_vec;
array<int, S + 10> grundy;
int n, fold, a;
int main() {
for(int i = 2; i <= S; i++) {
for(int j = 1; j < M; j++) {
if(mex_vec[i][j] == 0) {
grundy[i] = j;
break;
}
}
for(int j = i; j <= S; j += i)
mex_vec[j][grundy[i]] = 1;
}
cin >> n;
while(n--) {
cin >> a;
fold ^= grundy[a];
}
cout << (fold ? "white" : "black") << '\n';
return 0;
}
nok0