結果

問題 No.1665 quotient replace
ユーザー milanis48663220milanis48663220
提出日時 2021-09-03 21:27:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 216 ms / 3,000 ms
コード長 1,341 bytes
コンパイル時間 1,093 ms
コンパイル使用メモリ 117,512 KB
実行使用メモリ 18,760 KB
最終ジャッジ日時 2023-08-21 19:40:31
合計ジャッジ時間 9,355 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
11,556 KB
testcase_01 AC 96 ms
11,632 KB
testcase_02 AC 98 ms
11,560 KB
testcase_03 AC 98 ms
14,376 KB
testcase_04 AC 98 ms
14,360 KB
testcase_05 AC 97 ms
14,072 KB
testcase_06 AC 99 ms
15,188 KB
testcase_07 AC 99 ms
14,840 KB
testcase_08 AC 100 ms
15,104 KB
testcase_09 AC 104 ms
15,220 KB
testcase_10 AC 137 ms
16,024 KB
testcase_11 AC 188 ms
17,760 KB
testcase_12 AC 105 ms
15,232 KB
testcase_13 AC 208 ms
18,720 KB
testcase_14 AC 208 ms
18,664 KB
testcase_15 AC 216 ms
18,724 KB
testcase_16 AC 210 ms
18,760 KB
testcase_17 AC 211 ms
18,720 KB
testcase_18 AC 93 ms
13,580 KB
testcase_19 AC 94 ms
13,608 KB
testcase_20 AC 92 ms
13,560 KB
testcase_21 AC 94 ms
11,748 KB
testcase_22 AC 96 ms
13,608 KB
testcase_23 AC 97 ms
11,748 KB
testcase_24 AC 95 ms
13,548 KB
testcase_25 AC 96 ms
13,548 KB
testcase_26 AC 96 ms
15,104 KB
testcase_27 AC 97 ms
15,068 KB
testcase_28 AC 100 ms
15,152 KB
testcase_29 AC 105 ms
15,120 KB
testcase_30 AC 155 ms
16,948 KB
testcase_31 AC 181 ms
17,888 KB
testcase_32 AC 183 ms
17,580 KB
testcase_33 AC 130 ms
15,892 KB
testcase_34 AC 169 ms
17,220 KB
testcase_35 AC 159 ms
16,812 KB
testcase_36 AC 159 ms
16,856 KB
testcase_37 AC 154 ms
16,816 KB
testcase_38 AC 167 ms
17,280 KB
testcase_39 AC 146 ms
16,440 KB
testcase_40 AC 148 ms
16,392 KB
testcase_41 AC 146 ms
16,440 KB
testcase_42 AC 96 ms
11,516 KB
testcase_43 AC 94 ms
11,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cmath>
#include <numeric>
#include <functional>
#include <cassert>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
typedef long long ll;

int cnt[1000001];
int v[1000001];
int g[1000001];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    for(int i = 1; i <= 1000000; i++) v[i] = i;
    for(int i = 2; i <= 1000000; i++){
        for(int j = 1; i*j <= 1000000; j++){
            while(v[i*j]%i == 0){
                g[i*j]++;
                v[i*j] /= i;
            }
        }
    }
    int x = 0;
    for(int i = 1; i <= 1000000; i++){
        if(cnt[i]%2 == 1) x ^= g[i];
    }
    if(x == 0) cout << "black" << endl;
    else cout << "white" << endl;
}
0