結果

問題 No.1665 quotient replace
ユーザー kai4096_donkai4096_don
提出日時 2021-09-09 23:07:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2,978 ms / 3,000 ms
コード長 988 bytes
コンパイル時間 4,734 ms
コンパイル使用メモリ 234,856 KB
実行使用メモリ 228,120 KB
最終ジャッジ日時 2023-08-30 04:41:11
合計ジャッジ時間 130,731 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,580 ms
227,472 KB
testcase_01 AC 2,602 ms
227,452 KB
testcase_02 AC 2,609 ms
227,416 KB
testcase_03 AC 2,596 ms
227,536 KB
testcase_04 AC 2,636 ms
227,524 KB
testcase_05 AC 2,660 ms
227,532 KB
testcase_06 AC 2,663 ms
227,452 KB
testcase_07 AC 2,626 ms
227,544 KB
testcase_08 AC 2,636 ms
227,964 KB
testcase_09 AC 2,632 ms
227,696 KB
testcase_10 AC 2,754 ms
227,696 KB
testcase_11 AC 2,909 ms
228,040 KB
testcase_12 AC 2,636 ms
228,056 KB
testcase_13 AC 2,978 ms
227,420 KB
testcase_14 AC 2,946 ms
227,524 KB
testcase_15 AC 2,974 ms
228,120 KB
testcase_16 AC 2,954 ms
227,960 KB
testcase_17 AC 2,944 ms
228,044 KB
testcase_18 AC 2,670 ms
227,520 KB
testcase_19 AC 2,690 ms
227,404 KB
testcase_20 AC 2,609 ms
227,484 KB
testcase_21 AC 2,583 ms
227,964 KB
testcase_22 AC 2,596 ms
227,536 KB
testcase_23 AC 2,567 ms
227,408 KB
testcase_24 AC 2,632 ms
227,732 KB
testcase_25 AC 2,639 ms
227,592 KB
testcase_26 AC 2,646 ms
227,480 KB
testcase_27 AC 2,653 ms
228,028 KB
testcase_28 AC 2,664 ms
228,032 KB
testcase_29 AC 2,629 ms
228,028 KB
testcase_30 AC 2,790 ms
228,060 KB
testcase_31 AC 2,868 ms
227,592 KB
testcase_32 AC 2,873 ms
227,412 KB
testcase_33 AC 2,683 ms
227,812 KB
testcase_34 AC 2,788 ms
227,700 KB
testcase_35 AC 2,834 ms
227,656 KB
testcase_36 AC 2,869 ms
227,980 KB
testcase_37 AC 2,825 ms
228,040 KB
testcase_38 AC 2,893 ms
227,408 KB
testcase_39 AC 2,800 ms
227,532 KB
testcase_40 AC 2,838 ms
227,712 KB
testcase_41 AC 2,825 ms
227,668 KB
testcase_42 AC 2,615 ms
227,540 KB
testcase_43 AC 2,656 ms
227,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
//const long nPrime = 1000000007;
//const long nPrime = 998244353;
typedef long long ll;
int main() {
    long nMax = 1000001;
    vector<long> viGrundy(nMax,0);
    vector<set<long>> vsiNum(nMax);
    for(long i = 1; i < nMax; i++){
        vsiNum[i].insert(0);
    }
    for(long i = 2; i < nMax; i++){
        for(auto itr = vsiNum[i].begin(); itr != vsiNum[i].end(); itr++){
            if(*itr == viGrundy[i]){
                viGrundy[i]++;
            } else {
                break;
            }
        }
        for(long j = 2; i*j < nMax; j++){
            vsiNum[i*j].insert(viGrundy[i]);
        }
    }
    
    long n;
    cin >> n;
    long nSum = 0;
    for(long i = 0; i < n; i++){
        long a;
        cin >> a;
        nSum ^= viGrundy[a];
    }
    if(nSum != 0){
        cout << "white" << endl;
    } else {
        cout << "black" << endl;
    }
    
    return 0;
}
0