結果

問題 No.1665 quotient replace
ユーザー KKT89
提出日時 2021-09-03 23:33:47
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,975 ms / 3,000 ms
コード長 1,175 bytes
コンパイル時間 1,682 ms
コンパイル使用メモリ 124,500 KB
最終ジャッジ日時 2025-01-24 07:20:40
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

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