結果
問題 | No.1665 quotient replace |
ユーザー | Sooh317 |
提出日時 | 2021-09-03 21:49:39 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 254 ms / 3,000 ms |
コード長 | 4,700 bytes |
コンパイル時間 | 4,352 ms |
コンパイル使用メモリ | 269,608 KB |
実行使用メモリ | 11,260 KB |
最終ジャッジ日時 | 2024-12-15 12:17:13 |
合計ジャッジ時間 | 9,748 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
7,320 KB |
testcase_01 | AC | 15 ms
7,200 KB |
testcase_02 | AC | 14 ms
7,204 KB |
testcase_03 | AC | 14 ms
7,336 KB |
testcase_04 | AC | 15 ms
7,264 KB |
testcase_05 | AC | 15 ms
7,296 KB |
testcase_06 | AC | 16 ms
7,264 KB |
testcase_07 | AC | 14 ms
7,208 KB |
testcase_08 | AC | 14 ms
7,424 KB |
testcase_09 | AC | 21 ms
7,376 KB |
testcase_10 | AC | 91 ms
8,576 KB |
testcase_11 | AC | 199 ms
10,184 KB |
testcase_12 | AC | 33 ms
7,668 KB |
testcase_13 | AC | 250 ms
11,260 KB |
testcase_14 | AC | 254 ms
11,124 KB |
testcase_15 | AC | 250 ms
11,128 KB |
testcase_16 | AC | 248 ms
11,116 KB |
testcase_17 | AC | 247 ms
11,204 KB |
testcase_18 | AC | 15 ms
7,296 KB |
testcase_19 | AC | 15 ms
7,200 KB |
testcase_20 | AC | 13 ms
7,540 KB |
testcase_21 | AC | 13 ms
7,248 KB |
testcase_22 | AC | 14 ms
7,272 KB |
testcase_23 | AC | 14 ms
7,200 KB |
testcase_24 | AC | 14 ms
7,240 KB |
testcase_25 | AC | 15 ms
7,268 KB |
testcase_26 | AC | 14 ms
7,292 KB |
testcase_27 | AC | 16 ms
7,424 KB |
testcase_28 | AC | 19 ms
7,424 KB |
testcase_29 | AC | 24 ms
7,552 KB |
testcase_30 | AC | 89 ms
9,288 KB |
testcase_31 | AC | 127 ms
10,248 KB |
testcase_32 | AC | 182 ms
10,208 KB |
testcase_33 | AC | 86 ms
8,456 KB |
testcase_34 | AC | 158 ms
9,548 KB |
testcase_35 | AC | 147 ms
9,404 KB |
testcase_36 | AC | 145 ms
9,412 KB |
testcase_37 | AC | 142 ms
9,188 KB |
testcase_38 | AC | 155 ms
9,704 KB |
testcase_39 | AC | 110 ms
8,876 KB |
testcase_40 | AC | 113 ms
8,892 KB |
testcase_41 | AC | 144 ms
8,960 KB |
testcase_42 | AC | 15 ms
7,296 KB |
testcase_43 | AC | 15 ms
7,296 KB |
ソースコード
/** * author: Sooh * created: 03.09.2021 21:44:22 **/ #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; struct Sieve { int MX; vector<bool> ip; // is prime vector<int> mu; // mobius vector<int> mf; // min factor Sieve(int _MX = 1000005, bool mobius = false):MX(_MX){ ip.resize(MX, true); mf.resize(MX, 1); ip[0] = ip[1] = false; if(mobius){ mu.resize(MX, 1); for(int i = 2; i < MX; i++){ if(!ip[i]) continue; ip[i] = true; mf[i] = i; mu[i] = -1; for(int j = i+i; j < MX; j += i){ ip[j] = false; if(mf[j] == 1) mf[j] = i; if(j / i % i == 0) mu[j] = 0; else mu[j] = -mu[j]; } } } else{ for(int i = 2; i < MX; i++){ if(!ip[i]) continue; ip[i] = true; mf[i] = i; for(int j = i+i; j < MX; j += i){ ip[j] = false; if(mf[j] == 1) mf[j] = i; } } } } vector<pair<int, int>> factorize(int n){ vector<pair<int, int>> res; int p = mf[n], e = 0; while(n != 1){ while(n % p == 0){ n /= p; ++e; } res.emplace_back(p, e); p = mf[n], e = 0; } return res; } /* make 1-indexed vectors */ // return F where F(i) = Σf(k) (i|k) template<class T> void fast_zeta(vector<T> &f){ int N = f.size(); for(int i = 2; i < N; i++){ if(!ip[i]) continue; for(int j = (N - 1)/i; j >= 1; --j) f[j] += f[i*j]; } } // return f where F(i) = Σf(k) (i|k) template<class T> void fast_mobius(vector<T> &F){ int N = F.size(); for(int i = 2; i < N; i++){ if(!ip[i]) continue; for(int j = 1; j <= (N - 1)/i; ++j) F[j] -= F[i*j]; } } // return h where h(k) = Σ f(i)*g(i) (gcd(i, j) = k) in O(NloglogN) template<class T> vector<T> gcd_convolution(const vector<T> &f, const vector<T> &g){ int N = max(f.size(), g.size()); vector<T> F(N), G(N), h(N); for(int i = 0; i < (int)f.size(); i++) F[i] = f[i]; for(int i = 0; i < (int)g.size(); i++) G[i] = g[i]; fast_zeta(F); fast_zeta(G); for(int i = 1; i < N; i++) h[i] = F[i] * G[i]; fast_mobius(h); return h; } }; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); //cout << fixed << setprecision(20); Sieve s; int n; cin >> n; V<int> a(n); rep(i,n) cin >> a[i]; int x = 0; rep(i,n){ auto res = s.factorize(a[i]); int cnt = 0; for(auto p : res){ cnt += p.se; } x ^= cnt; } cout << (x == 0 ? "black" : "white") << endl; }