結果

問題 No.1665 quotient replace
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-01-16 20:44:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 625 ms / 3,000 ms
コード長 949 bytes
コンパイル時間 1,765 ms
コンパイル使用メモリ 114,028 KB
実行使用メモリ 10,856 KB
最終ジャッジ日時 2023-08-30 03:21:20
合計ジャッジ時間 12,896 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
10,632 KB
testcase_01 AC 12 ms
10,600 KB
testcase_02 AC 12 ms
10,644 KB
testcase_03 AC 12 ms
10,640 KB
testcase_04 AC 13 ms
10,756 KB
testcase_05 AC 12 ms
10,688 KB
testcase_06 AC 15 ms
10,644 KB
testcase_07 AC 12 ms
10,644 KB
testcase_08 AC 15 ms
10,856 KB
testcase_09 AC 30 ms
10,700 KB
testcase_10 AC 215 ms
10,536 KB
testcase_11 AC 467 ms
10,664 KB
testcase_12 AC 60 ms
10,644 KB
testcase_13 AC 620 ms
10,532 KB
testcase_14 AC 625 ms
10,636 KB
testcase_15 AC 610 ms
10,600 KB
testcase_16 AC 622 ms
10,632 KB
testcase_17 AC 622 ms
10,760 KB
testcase_18 AC 13 ms
10,592 KB
testcase_19 AC 12 ms
10,836 KB
testcase_20 AC 11 ms
10,640 KB
testcase_21 AC 11 ms
10,628 KB
testcase_22 AC 11 ms
10,640 KB
testcase_23 AC 11 ms
10,644 KB
testcase_24 AC 12 ms
10,644 KB
testcase_25 AC 11 ms
10,532 KB
testcase_26 AC 12 ms
10,736 KB
testcase_27 AC 13 ms
10,700 KB
testcase_28 AC 23 ms
10,652 KB
testcase_29 AC 36 ms
10,532 KB
testcase_30 AC 200 ms
10,856 KB
testcase_31 AC 305 ms
10,644 KB
testcase_32 AC 451 ms
10,640 KB
testcase_33 AC 177 ms
10,648 KB
testcase_34 AC 372 ms
10,548 KB
testcase_35 AC 343 ms
10,572 KB
testcase_36 AC 364 ms
10,532 KB
testcase_37 AC 326 ms
10,820 KB
testcase_38 AC 389 ms
10,644 KB
testcase_39 AC 277 ms
10,628 KB
testcase_40 AC 272 ms
10,696 KB
testcase_41 AC 270 ms
10,760 KB
testcase_42 AC 11 ms
10,712 KB
testcase_43 AC 12 ms
10,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <sstream>

using namespace std;

vector<long long> spf;
map<long long, long long> prime;

void osa_k(long long n){
    spf.resize(n+1);
    for (long long i=0; i<=n; i++) spf[i] = i;
    for (long long i=2; i*i<=n; i++){
        if (spf[i] == i){
            for (long long j=2; i*j <= n; j++){
                spf[i*j] = min(spf[i*j], i);
            }
        }
    }
}

int prime_factor(long long n){
    prime.clear();
    int cnt = 0;
    while(n != 1){
        cnt++;
        prime[spf[n]]++;
        n /= spf[n];
    }
    return cnt;
}

int main(){
    osa_k(1000000);
    int N, A, g=0;
    cin >> N;

    for (int i=0; i<N; i++){
        cin >> A;
        g ^= prime_factor(A);
    }

    cout << (g == 0 ? "black" : "white") << endl;

    return 0;
}
0