結果
| 問題 | 
                            No.1665 quotient replace
                             | 
                    
| コンテスト | |
| ユーザー | 
                             nok0
                         | 
                    
| 提出日時 | 2021-09-03 20:40:21 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 453 ms / 3,000 ms | 
| コード長 | 495 bytes | 
| コンパイル時間 | 1,785 ms | 
| コンパイル使用メモリ | 193,048 KB | 
| 最終ジャッジ日時 | 2025-01-24 04:29:38 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 41 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int M = 241;
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;
}
            
            
            
        
            
nok0