結果
問題 | No.1665 quotient replace |
ユーザー | packer_jp |
提出日時 | 2021-09-03 21:44:54 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 508 ms / 3,000 ms |
コード長 | 3,172 bytes |
コンパイル時間 | 2,345 ms |
コンパイル使用メモリ | 205,680 KB |
実行使用メモリ | 14,976 KB |
最終ジャッジ日時 | 2024-05-09 02:53:55 |
合計ジャッジ時間 | 10,453 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 8 ms
7,152 KB |
testcase_01 | AC | 9 ms
7,168 KB |
testcase_02 | AC | 10 ms
7,296 KB |
testcase_03 | AC | 9 ms
7,112 KB |
testcase_04 | AC | 8 ms
7,168 KB |
testcase_05 | AC | 9 ms
7,296 KB |
testcase_06 | AC | 12 ms
7,248 KB |
testcase_07 | AC | 10 ms
7,072 KB |
testcase_08 | AC | 11 ms
7,132 KB |
testcase_09 | AC | 23 ms
7,416 KB |
testcase_10 | AC | 169 ms
9,728 KB |
testcase_11 | AC | 383 ms
12,996 KB |
testcase_12 | AC | 47 ms
7,936 KB |
testcase_13 | AC | 496 ms
14,976 KB |
testcase_14 | AC | 501 ms
14,884 KB |
testcase_15 | AC | 499 ms
14,928 KB |
testcase_16 | AC | 508 ms
14,976 KB |
testcase_17 | AC | 497 ms
14,976 KB |
testcase_18 | AC | 9 ms
7,084 KB |
testcase_19 | AC | 9 ms
7,096 KB |
testcase_20 | AC | 8 ms
7,144 KB |
testcase_21 | AC | 9 ms
7,168 KB |
testcase_22 | AC | 8 ms
7,100 KB |
testcase_23 | AC | 8 ms
7,168 KB |
testcase_24 | AC | 10 ms
7,168 KB |
testcase_25 | AC | 9 ms
7,168 KB |
testcase_26 | AC | 10 ms
7,168 KB |
testcase_27 | AC | 11 ms
7,152 KB |
testcase_28 | AC | 21 ms
7,424 KB |
testcase_29 | AC | 34 ms
7,680 KB |
testcase_30 | AC | 192 ms
10,908 KB |
testcase_31 | AC | 290 ms
13,184 KB |
testcase_32 | AC | 363 ms
12,792 KB |
testcase_33 | AC | 135 ms
9,216 KB |
testcase_34 | AC | 296 ms
11,648 KB |
testcase_35 | AC | 264 ms
11,392 KB |
testcase_36 | AC | 283 ms
11,520 KB |
testcase_37 | AC | 249 ms
11,136 KB |
testcase_38 | AC | 301 ms
11,904 KB |
testcase_39 | AC | 214 ms
10,624 KB |
testcase_40 | AC | 217 ms
10,496 KB |
testcase_41 | AC | 216 ms
10,420 KB |
testcase_42 | AC | 9 ms
7,100 KB |
testcase_43 | AC | 8 ms
7,248 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define all(a) (a).begin(), (a).end() using ll = long long; using ull = unsigned long long; using vll = vector<ll>; ull bit(int n) { return 1ull << n; } ll sign(ll a) { return (a > 0) - (a < 0); } ll fdiv(ll a, ll b) { return a / b - ((a ^ b) < 0 && a % b); } ll cdiv(ll a, ll b) { return -fdiv(-a, b); } template <typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>; template <typename T> T sq(const T &a) { return a * a; } template <typename T, typename U> bool chmax(T &a, const U &b) { return ((a < b) ? (a = b, true) : (false)); } template <typename T, typename U> bool chmin(T &a, const U &b) { return ((a > b) ? (a = b, true) : (false)); } template <typename T> ostream &operator<<(ostream &os, const vector<T> &a) { os << "("; for (auto itr = a.begin(); itr != a.end(); itr++) { os << *itr << (next(itr) != a.end() ? ", " : ""); } os << ")"; return os; } #ifdef ONLINE_JUDGE #define dump(...) (void(0)) #else void debug() { cerr << endl; } template <typename Head, typename... Tail> void debug(Head &&head, Tail &&... tail) { cerr << head; if (sizeof...(Tail)) cerr << ", "; debug(tail...); } #define dump(...) cerr << __LINE__ << ": " << #__VA_ARGS__ << " = ", debug(__VA_ARGS__) #endif struct rep { struct itr { int v; itr(int v) : v(v) {} void operator++() { ++v; } int operator*() const { return v; } bool operator!=(const itr &i) const { return v != i.v; } }; int l, r; rep(int r) : l(min(0, r)), r(r) {} rep(int l, int r) : l(min(l, r)), r(r) {} itr begin() const { return l; }; itr end() const { return r; }; }; struct per { struct itr { int v; itr(int v) : v(v) {} void operator++() { --v; } int operator*() const { return v; } bool operator!=(const itr &i) const { return v != i.v; } }; int l, r; per(int r) : l(min(0, r)), r(r) {} per(int l, int r) : l(min(l, r)), r(r) {} itr begin() const { return r - 1; }; itr end() const { return l - 1; }; }; template <typename F> ll binary_search(ll ok, ll ng, F is_ok) { while (abs(ok - ng) > 1) { ll mid = (ok + ng) / 2; (is_ok(mid) ? ok : ng) = mid; } return ok; } struct multi_prime_factorize { std::vector<int> spf; multi_prime_factorize(int n) : spf(n + 1) { std::iota(spf.begin(), spf.end(), 0LL); for (int i = 2; i * i <= n; i++) { if (spf[i] < i) { continue; } for (int j = i * i; j <= n; j += i) { if (spf[j] == j) { spf[j] = i; } } } } std::vector<int> prime_factorize(int a) { std::vector<int> ret; while (a > 1) { ret.emplace_back(spf[a]); a /= spf[a]; } return ret; } }; int main() { ll n; cin >> n; vll a(n); multi_prime_factorize mpf(1e6); ll g = 0; for (ll i : rep(n)) { cin >> a[i]; g ^= mpf.prime_factorize(a[i]).size(); } if (g == 0) { cout << "black" << endl; } else { cout << "white" << endl; } }