結果

問題 No.1665 quotient replace
ユーザー abc3abc3
提出日時 2021-09-04 00:19:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 177 ms / 3,000 ms
コード長 1,572 bytes
コンパイル時間 2,389 ms
コンパイル使用メモリ 203,672 KB
実行使用メモリ 10,844 KB
最終ジャッジ日時 2023-08-22 02:55:43
合計ジャッジ時間 7,505 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,844 KB
testcase_01 AC 11 ms
6,892 KB
testcase_02 AC 11 ms
7,128 KB
testcase_03 AC 11 ms
6,888 KB
testcase_04 AC 11 ms
6,964 KB
testcase_05 AC 11 ms
6,884 KB
testcase_06 AC 12 ms
6,852 KB
testcase_07 AC 11 ms
6,844 KB
testcase_08 AC 12 ms
6,852 KB
testcase_09 AC 15 ms
7,152 KB
testcase_10 AC 65 ms
8,156 KB
testcase_11 AC 133 ms
9,796 KB
testcase_12 AC 24 ms
7,112 KB
testcase_13 AC 169 ms
10,740 KB
testcase_14 AC 169 ms
10,812 KB
testcase_15 AC 169 ms
10,748 KB
testcase_16 AC 169 ms
10,840 KB
testcase_17 AC 177 ms
10,844 KB
testcase_18 AC 11 ms
6,848 KB
testcase_19 AC 11 ms
6,872 KB
testcase_20 AC 11 ms
6,884 KB
testcase_21 AC 11 ms
6,948 KB
testcase_22 AC 12 ms
6,924 KB
testcase_23 AC 11 ms
6,836 KB
testcase_24 AC 11 ms
6,876 KB
testcase_25 AC 11 ms
6,844 KB
testcase_26 AC 11 ms
6,952 KB
testcase_27 AC 12 ms
6,844 KB
testcase_28 AC 14 ms
7,144 KB
testcase_29 AC 18 ms
7,184 KB
testcase_30 AC 60 ms
9,172 KB
testcase_31 AC 85 ms
9,952 KB
testcase_32 AC 127 ms
9,816 KB
testcase_33 AC 53 ms
8,004 KB
testcase_34 AC 104 ms
9,300 KB
testcase_35 AC 99 ms
8,948 KB
testcase_36 AC 101 ms
8,964 KB
testcase_37 AC 93 ms
8,956 KB
testcase_38 AC 111 ms
9,224 KB
testcase_39 AC 80 ms
8,440 KB
testcase_40 AC 80 ms
8,492 KB
testcase_41 AC 79 ms
8,484 KB
testcase_42 AC 11 ms
6,912 KB
testcase_43 AC 11 ms
6,844 KB
権限があれば一括ダウンロードができます

ソースコード

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];
        vector<int>d(1000001);
        for(int i=2;i<=1000000;i++){
            if(d[i]){continue;}
            for(int j=i;j<=1000000;j+=i){
                d[j]=i;
            }
        }
        int ans=0;
        rep(i,n){
            int cnt=0;
            while(a[i]>1){
                a[i]/=d[a[i]];
                cnt++;
            }
            ans^=cnt;
        }
        if(ans){cout<<"white"<<endl;}
        else{cout<<"black"<<endl;}
    }  

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