結果

問題 No.1665 quotient replace
ユーザー Sooh317Sooh317
提出日時 2021-09-14 18:47:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 202 ms / 3,000 ms
コード長 2,304 bytes
コンパイル時間 5,286 ms
コンパイル使用メモリ 261,296 KB
実行使用メモリ 38,824 KB
最終ジャッジ日時 2023-09-09 16:48:42
合計ジャッジ時間 14,456 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
38,596 KB
testcase_01 AC 103 ms
38,520 KB
testcase_02 AC 101 ms
38,612 KB
testcase_03 AC 102 ms
38,584 KB
testcase_04 AC 104 ms
38,544 KB
testcase_05 AC 102 ms
38,520 KB
testcase_06 AC 104 ms
38,760 KB
testcase_07 AC 104 ms
38,616 KB
testcase_08 AC 100 ms
38,544 KB
testcase_09 AC 104 ms
38,600 KB
testcase_10 AC 135 ms
38,764 KB
testcase_11 AC 176 ms
38,612 KB
testcase_12 AC 113 ms
38,652 KB
testcase_13 AC 201 ms
38,804 KB
testcase_14 AC 199 ms
38,612 KB
testcase_15 AC 202 ms
38,532 KB
testcase_16 AC 198 ms
38,544 KB
testcase_17 AC 197 ms
38,532 KB
testcase_18 AC 103 ms
38,532 KB
testcase_19 AC 104 ms
38,576 KB
testcase_20 AC 101 ms
38,540 KB
testcase_21 AC 103 ms
38,544 KB
testcase_22 AC 106 ms
38,624 KB
testcase_23 AC 100 ms
38,624 KB
testcase_24 AC 102 ms
38,564 KB
testcase_25 AC 103 ms
38,540 KB
testcase_26 AC 102 ms
38,532 KB
testcase_27 AC 102 ms
38,632 KB
testcase_28 AC 106 ms
38,580 KB
testcase_29 AC 111 ms
38,544 KB
testcase_30 AC 154 ms
38,576 KB
testcase_31 AC 182 ms
38,668 KB
testcase_32 AC 178 ms
38,576 KB
testcase_33 AC 134 ms
38,524 KB
testcase_34 AC 162 ms
38,548 KB
testcase_35 AC 157 ms
38,612 KB
testcase_36 AC 158 ms
38,824 KB
testcase_37 AC 154 ms
38,628 KB
testcase_38 AC 164 ms
38,524 KB
testcase_39 AC 145 ms
38,780 KB
testcase_40 AC 148 ms
38,624 KB
testcase_41 AC 146 ms
38,584 KB
testcase_42 AC 101 ms
38,664 KB
testcase_43 AC 103 ms
38,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *    author:  Sooh
 *    created: 14.09.2021 18:27:33
**/
#include<bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
//using mint = modint998244353;
//using mint = modint1000000007;
#endif
#pragma region template
using ll = long long;
template <class T> using V = vector<T>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define debug(var)  do{std::cerr << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cerr << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cerr << e << " "; } std::cerr << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){cerr << endl;int cnt = 0;for(const auto& v : vv){cerr << cnt << "th : "; view(v); cnt++;} cerr << endl;}
ll power(ll a, ll p){ll ret = 1; while(p){if(p & 1){ret = ret * a;} a = a * a; p >>= 1;} return ret;}
ll modpow(ll a, ll p, ll mod){ll ret = 1; while(p){if(p & 1){ret = ret * a % mod;} a = a * a % mod; p >>= 1;} return ret;}
ll modinv(ll a, ll m) {ll b = m, u = 1, v = 0; while (b) {ll t = a / b ;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}
template<class T, class K>bool chmax(T &a, const K b) { if (a<b) { a=b; return 1; } return 0; }
template<class T, class K>bool chmin(T &a, const K b) { if (b<a) { a=b; return 1; } return 0; }
#pragma endregion
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
const int inf = 1001001001;
const ll INF = 1001001001001001001ll;
//const double pi = acos(-1);
//const ll mod = 998244353;
const ll mod = 1000000007;
#define MAX 1000001

int grundy[MAX];
bitset<250> bits[MAX];

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);
    int n; cin >> n;
    for(int i = 2; i < MAX; i++){
        int j = 1;
        while(bits[i][j]) j++;
        grundy[i] = j;
        for(int j = i<<1; j < MAX; j += i) bits[j][grundy[i]] = 1;
    }
    int p = 0;
    while(n--){
        int a; cin >> a;
        p ^= grundy[a];
    }
    cout << (p ? "white" : "black") << endl;
}
0