結果

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

ソースコード

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;
}

template<typename T>
map<T,ll> factorize(T x){
    map<T,ll> res;
    for(ll i=2;i*i<=x;i++){
        while(x%i==0){
            x/=i;
            res[i]++;
        }
    }
    if(x!=1) res[x]++;
    return res;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<ll> a(n);
    ll k=0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        auto m=factorize(a[i]);
        a[i]=0;
        for(auto p:m){
            a[i]+=(p.second);
        }
        //cout << a[i] << endl;
        k^=a[i];
    }
    if(k){
        cout << "white" << endl;
    }
    else{
        cout << "black" << endl; 
    }
}
0