結果

問題 No.1665 quotient replace
ユーザー nawawan
提出日時 2021-09-03 21:45:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,772 ms / 3,000 ms
コード長 750 bytes
コンパイル時間 2,377 ms
コンパイル使用メモリ 199,820 KB
最終ジャッジ日時 2025-01-24 05:20:33
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    vector<vector<bool>> used(1000010, vector<bool>(200, false));
    vector<int> gr(1000010);
    for(int i = 1; i <= 1000000; i++){
        int now = -1;
        for(int j = 0; j < 200; j++){
            if(!used[i][j]) {
                now = j;
                break;
            }
        }
        gr[i] = now;
        int t = i * 2;
        while(t <= 1000000){
            used[t][now] = true;
            t += i;
        }
    }
    int res = 0;
    for(int i = 0; i < N; i++){
        res ^= gr[A[i]];
    }
    if(res == 0) cout << "black" << endl;
    else cout << "white" << endl;
}
0