結果

問題 No.1665 quotient replace
ユーザー miscalcmiscalc
提出日時 2021-09-03 21:50:40
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 547 ms / 3,000 ms
コード長 1,445 bytes
コンパイル時間 2,200 ms
コンパイル使用メモリ 202,028 KB
実行使用メモリ 29,308 KB
最終ジャッジ日時 2023-08-21 21:18:13
合計ジャッジ時間 18,682 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 238 ms
13,404 KB
testcase_01 AC 231 ms
13,400 KB
testcase_02 AC 237 ms
13,296 KB
testcase_03 AC 236 ms
13,668 KB
testcase_04 AC 234 ms
13,728 KB
testcase_05 AC 235 ms
13,344 KB
testcase_06 AC 228 ms
13,648 KB
testcase_07 AC 227 ms
13,520 KB
testcase_08 AC 235 ms
13,652 KB
testcase_09 AC 228 ms
13,856 KB
testcase_10 AC 336 ms
18,744 KB
testcase_11 AC 464 ms
25,156 KB
testcase_12 AC 264 ms
14,648 KB
testcase_13 AC 527 ms
29,156 KB
testcase_14 AC 513 ms
28,936 KB
testcase_15 AC 547 ms
29,028 KB
testcase_16 AC 527 ms
29,308 KB
testcase_17 AC 547 ms
29,028 KB
testcase_18 AC 241 ms
13,296 KB
testcase_19 AC 241 ms
13,292 KB
testcase_20 AC 249 ms
13,324 KB
testcase_21 AC 241 ms
13,400 KB
testcase_22 AC 235 ms
13,404 KB
testcase_23 AC 232 ms
13,344 KB
testcase_24 AC 218 ms
13,252 KB
testcase_25 AC 225 ms
13,412 KB
testcase_26 AC 228 ms
13,604 KB
testcase_27 AC 220 ms
13,656 KB
testcase_28 AC 244 ms
13,984 KB
testcase_29 AC 259 ms
14,696 KB
testcase_30 AC 380 ms
21,376 KB
testcase_31 AC 459 ms
25,644 KB
testcase_32 AC 443 ms
24,664 KB
testcase_33 AC 316 ms
18,060 KB
testcase_34 AC 417 ms
22,596 KB
testcase_35 AC 388 ms
21,776 KB
testcase_36 AC 387 ms
22,216 KB
testcase_37 AC 362 ms
21,448 KB
testcase_38 AC 404 ms
23,232 KB
testcase_39 AC 355 ms
20,100 KB
testcase_40 AC 371 ms
19,968 KB
testcase_41 AC 359 ms
20,236 KB
testcase_42 AC 234 ms
13,284 KB
testcase_43 AC 225 ms
13,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
//using mint = modint1000000007;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using tlll = tuple<ll, ll, ll>;
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll safemod(ll A, ll M) {return (A % M + M) % M;}
ll divfloor(ll A, ll B) {if (B < 0) {return divfloor(-A, -B);} return (A - safemod(A, B)) / B;}
ll divceil(ll A, ll B) {if (B < 0) {return divceil(-A, -B);} return divfloor(A + B - 1, B);}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> A.at(i);
  }

  const ll M = 1333333;
  vector<ll> primecount(M, 0);
  for (ll p = 2; p < M; p++)
  {
    if (primecount.at(p) == 0)
    {
      for (ll k = 1; k * p < M; k++)
      {
        ll tmp = k * p;
        while (tmp % p == 0)
        {
          tmp /= p;
          primecount.at(k * p)++;
        }
      }
    }
  }

  vector<ll> B(N);
  for (ll i = 0; i < N; i++)
  {
    B.at(i) = primecount.at(A.at(i));
    //cerr << B.at(i) << endl;
  }

  ll x = 0;
  for (ll i = 0; i < N; i++)
  {
    x ^= B.at(i);
  }

  cout << (x == 0 ? "black\n" : "white\n");
}
0