結果

問題 No.1665 quotient replace
ユーザー KKT89KKT89
提出日時 2021-09-03 23:33:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,436 ms / 3,000 ms
コード長 1,175 bytes
コンパイル時間 1,626 ms
コンパイル使用メモリ 120,820 KB
実行使用メモリ 14,972 KB
最終ジャッジ日時 2023-08-22 01:46:49
合計ジャッジ時間 25,227 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,916 KB
testcase_01 AC 3 ms
6,976 KB
testcase_02 AC 3 ms
6,852 KB
testcase_03 AC 6 ms
6,980 KB
testcase_04 AC 5 ms
7,076 KB
testcase_05 AC 4 ms
6,856 KB
testcase_06 AC 20 ms
6,856 KB
testcase_07 AC 6 ms
6,960 KB
testcase_08 AC 13 ms
6,856 KB
testcase_09 AC 68 ms
7,232 KB
testcase_10 AC 628 ms
9,500 KB
testcase_11 AC 1,176 ms
12,868 KB
testcase_12 AC 171 ms
7,648 KB
testcase_13 AC 1,424 ms
14,576 KB
testcase_14 AC 1,436 ms
14,972 KB
testcase_15 AC 1,433 ms
14,628 KB
testcase_16 AC 1,436 ms
14,684 KB
testcase_17 AC 1,436 ms
14,956 KB
testcase_18 AC 4 ms
6,912 KB
testcase_19 AC 3 ms
6,960 KB
testcase_20 AC 3 ms
6,964 KB
testcase_21 AC 3 ms
6,960 KB
testcase_22 AC 3 ms
6,844 KB
testcase_23 AC 3 ms
6,956 KB
testcase_24 AC 3 ms
6,984 KB
testcase_25 AC 3 ms
7,052 KB
testcase_26 AC 18 ms
6,868 KB
testcase_27 AC 49 ms
6,860 KB
testcase_28 AC 188 ms
7,224 KB
testcase_29 AC 324 ms
7,520 KB
testcase_30 AC 600 ms
10,872 KB
testcase_31 AC 630 ms
13,156 KB
testcase_32 AC 1,147 ms
12,720 KB
testcase_33 AC 518 ms
8,980 KB
testcase_34 AC 986 ms
11,540 KB
testcase_35 AC 925 ms
11,012 KB
testcase_36 AC 946 ms
11,468 KB
testcase_37 AC 885 ms
11,024 KB
testcase_38 AC 1,015 ms
11,856 KB
testcase_39 AC 768 ms
10,284 KB
testcase_40 AC 755 ms
10,336 KB
testcase_41 AC 765 ms
10,344 KB
testcase_42 AC 3 ms
6,968 KB
testcase_43 AC 3 ms
6,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <sstream>
#include <utility>
#include <cstring>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<ll> a(n);
    vector<int> memo(1000001);
    ll k=0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        if(memo[a[i]]>0){
            k^=memo[a[i]];
            continue;
        }
        int aa = a[i];
        int sum = 0;
        for(int j=2;j*j<=a[i];j++){
            while(a[i]%j==0){
                sum++;
                a[i]/=j;
            }
        }
        if(a[i]>1)sum++;
        k^=sum;
        memo[aa] = sum;
    }
    if(k){
        cout << "white" << endl;
    }
    else{
        cout << "black" << endl; 
    }
}
0