結果

問題 No.1665 quotient replace
ユーザー abc3abc3
提出日時 2021-09-04 00:13:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,417 bytes
コンパイル時間 2,398 ms
コンパイル使用メモリ 207,828 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-05-09 08:39:10
合計ジャッジ時間 22,866 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,752 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 4 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 17 ms
5,376 KB
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 9 ms
5,376 KB
testcase_09 AC 57 ms
5,376 KB
testcase_10 AC 619 ms
5,376 KB
testcase_11 AC 1,415 ms
6,016 KB
testcase_12 AC 152 ms
5,376 KB
testcase_13 AC 1,831 ms
7,168 KB
testcase_14 AC 1,848 ms
7,168 KB
testcase_15 AC 1,831 ms
7,040 KB
testcase_16 AC 1,857 ms
7,196 KB
testcase_17 AC 1,862 ms
7,168 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 14 ms
5,376 KB
testcase_27 AC 43 ms
5,376 KB
testcase_28 AC 199 ms
5,376 KB
testcase_29 AC 403 ms
5,376 KB
testcase_30 TLE -
testcase_31 TLE -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます

ソースコード

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