結果

問題 No.1665 quotient replace
ユーザー んんんんんん
提出日時 2022-12-25 18:19:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 411 ms / 3,000 ms
コード長 708 bytes
コンパイル時間 2,119 ms
コンパイル使用メモリ 201,840 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-29 23:08:03
合計ジャッジ時間 9,630 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
7,168 KB
testcase_01 AC 10 ms
7,296 KB
testcase_02 AC 10 ms
7,296 KB
testcase_03 AC 10 ms
7,168 KB
testcase_04 AC 11 ms
7,296 KB
testcase_05 AC 11 ms
7,296 KB
testcase_06 AC 13 ms
7,168 KB
testcase_07 AC 11 ms
7,168 KB
testcase_08 AC 12 ms
7,168 KB
testcase_09 AC 22 ms
7,424 KB
testcase_10 AC 147 ms
8,576 KB
testcase_11 AC 311 ms
10,240 KB
testcase_12 AC 42 ms
7,424 KB
testcase_13 AC 401 ms
11,136 KB
testcase_14 AC 402 ms
11,008 KB
testcase_15 AC 411 ms
11,008 KB
testcase_16 AC 397 ms
11,136 KB
testcase_17 AC 404 ms
11,008 KB
testcase_18 AC 10 ms
7,296 KB
testcase_19 AC 11 ms
7,168 KB
testcase_20 AC 11 ms
7,168 KB
testcase_21 AC 11 ms
7,168 KB
testcase_22 AC 10 ms
7,168 KB
testcase_23 AC 10 ms
7,296 KB
testcase_24 AC 10 ms
7,168 KB
testcase_25 AC 10 ms
7,168 KB
testcase_26 AC 11 ms
7,168 KB
testcase_27 AC 13 ms
7,168 KB
testcase_28 AC 21 ms
7,296 KB
testcase_29 AC 31 ms
7,552 KB
testcase_30 AC 168 ms
9,216 KB
testcase_31 AC 257 ms
10,240 KB
testcase_32 AC 297 ms
9,984 KB
testcase_33 AC 114 ms
8,192 KB
testcase_34 AC 238 ms
9,472 KB
testcase_35 AC 217 ms
9,216 KB
testcase_36 AC 232 ms
9,472 KB
testcase_37 AC 219 ms
9,088 KB
testcase_38 AC 257 ms
9,600 KB
testcase_39 AC 180 ms
8,832 KB
testcase_40 AC 178 ms
8,960 KB
testcase_41 AC 180 ms
8,832 KB
testcase_42 AC 11 ms
7,168 KB
testcase_43 AC 10 ms
7,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const int MAX = 1e6;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    vector<int> spf(MAX+1);
    for (int i = 0; i <= MAX; i++) spf[i] = i;
    for (int i = 2; i*i <= MAX; i++) {
        if (spf[i] == i) {
            for (int j = 2*i; j <= MAX; j += i) {
                if (spf[j] == j) spf[j] = i;
            }
        }
    }

    int n = 0;
    for (int i = 0; i < N; i++) {
        int a = A[i];
        int cnt = 0;
        while (a != 1) {
            a /= spf[a];
            cnt++;
        }
        n ^= cnt;
    }

    if (n) cout << "white" << endl;
    else cout << "black" << endl;
}
0