結果

問題 No.1665 quotient replace
ユーザー milanis48663220milanis48663220
提出日時 2021-09-03 21:27:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 220 ms / 3,000 ms
コード長 1,341 bytes
コンパイル時間 1,194 ms
コンパイル使用メモリ 119,748 KB
実行使用メモリ 18,816 KB
最終ジャッジ日時 2024-05-09 01:40:15
合計ジャッジ時間 9,046 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
11,868 KB
testcase_01 AC 94 ms
11,356 KB
testcase_02 AC 97 ms
11,352 KB
testcase_03 AC 98 ms
14,724 KB
testcase_04 AC 94 ms
13,440 KB
testcase_05 AC 95 ms
11,776 KB
testcase_06 AC 95 ms
15,104 KB
testcase_07 AC 93 ms
14,080 KB
testcase_08 AC 95 ms
15,076 KB
testcase_09 AC 100 ms
15,160 KB
testcase_10 AC 133 ms
16,256 KB
testcase_11 AC 188 ms
17,768 KB
testcase_12 AC 104 ms
15,140 KB
testcase_13 AC 212 ms
18,816 KB
testcase_14 AC 209 ms
18,816 KB
testcase_15 AC 216 ms
18,700 KB
testcase_16 AC 220 ms
18,816 KB
testcase_17 AC 214 ms
18,724 KB
testcase_18 AC 96 ms
11,264 KB
testcase_19 AC 95 ms
11,136 KB
testcase_20 AC 95 ms
11,264 KB
testcase_21 AC 96 ms
11,136 KB
testcase_22 AC 98 ms
11,136 KB
testcase_23 AC 98 ms
11,136 KB
testcase_24 AC 96 ms
11,264 KB
testcase_25 AC 99 ms
11,136 KB
testcase_26 AC 98 ms
14,592 KB
testcase_27 AC 97 ms
15,104 KB
testcase_28 AC 99 ms
15,232 KB
testcase_29 AC 105 ms
15,136 KB
testcase_30 AC 154 ms
16,792 KB
testcase_31 AC 188 ms
17,992 KB
testcase_32 AC 185 ms
17,664 KB
testcase_33 AC 130 ms
15,920 KB
testcase_34 AC 171 ms
17,168 KB
testcase_35 AC 164 ms
17,024 KB
testcase_36 AC 169 ms
17,024 KB
testcase_37 AC 156 ms
16,760 KB
testcase_38 AC 171 ms
17,268 KB
testcase_39 AC 147 ms
16,512 KB
testcase_40 AC 146 ms
16,512 KB
testcase_41 AC 144 ms
16,640 KB
testcase_42 AC 96 ms
11,136 KB
testcase_43 AC 95 ms
11,136 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