結果

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

ソースコード

diff #

    #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)
    typedef long long ll;
    typedef long double ld;
    using P=pair<ll,ll>;
    const ld INF=1e18;
    const int mod=1e9+7;

    vector<pair<ll,ll>>prime_factorize(ll N) {
      vector<pair<ll,ll>>res;
      for (ll i= 2; i*i<=N;i++) {
        if (N%i!=0){continue;}
        ll cnt=0; 
        while(N%i==0){
          cnt++;
          N/=i;
        }
        res.push_back({i, cnt});
      }
      if(N!=1){res.push_back({N, 1});}
      return res;
    }

    void solve(){
        int n;
        cin>>n;
        vector<int>a(n);
        rep(i,n) cin>>a[i];
        map<int,int>mp;
        ll ans=0;
        rep(i,n){
            auto t=prime_factorize(a[i]);
            ll s=0;
            for(auto u:t){
                s+=u.second;
            }
            ans^=s;
        }
        if(ans){cout<<"white"<<endl;}
        else{cout<<"black"<<endl;}
    }  

    int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        
        solve();
        
        return 0;
    }
0