結果
問題 |
No.1665 quotient replace
|
ユーザー |
![]() |
提出日時 | 2021-08-10 23:12:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 469 ms / 3,000 ms |
コード長 | 494 bytes |
コンパイル時間 | 2,130 ms |
コンパイル使用メモリ | 193,916 KB |
最終ジャッジ日時 | 2025-01-23 17:27:19 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
#include <bits/stdc++.h> using namespace std; const int M = 30; const int S = 1000000; 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; }