結果

問題 No.1665 quotient replace
ユーザー SSRSSSRS
提出日時 2021-09-03 21:29:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 678 bytes
コンパイル時間 3,129 ms
コンパイル使用メモリ 173,700 KB
実行使用メモリ 125,556 KB
最終ジャッジ日時 2023-08-21 19:54:40
合計ジャッジ時間 110,982 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,250 ms
121,368 KB
testcase_01 AC 2,225 ms
121,204 KB
testcase_02 AC 2,230 ms
121,324 KB
testcase_03 AC 2,222 ms
121,352 KB
testcase_04 AC 2,247 ms
121,248 KB
testcase_05 AC 2,277 ms
121,268 KB
testcase_06 AC 2,224 ms
121,352 KB
testcase_07 AC 2,231 ms
121,432 KB
testcase_08 AC 2,233 ms
121,420 KB
testcase_09 AC 2,238 ms
121,272 KB
testcase_10 AC 2,330 ms
122,628 KB
testcase_11 AC 2,468 ms
124,328 KB
testcase_12 AC 2,280 ms
121,572 KB
testcase_13 AC 2,767 ms
125,244 KB
testcase_14 AC 2,528 ms
125,556 KB
testcase_15 AC 2,535 ms
125,532 KB
testcase_16 AC 2,528 ms
125,124 KB
testcase_17 AC 2,523 ms
125,532 KB
testcase_18 AC 2,256 ms
121,488 KB
testcase_19 AC 2,249 ms
121,324 KB
testcase_20 AC 2,225 ms
121,304 KB
testcase_21 AC 2,207 ms
121,352 KB
testcase_22 AC 2,228 ms
121,424 KB
testcase_23 AC 2,246 ms
121,368 KB
testcase_24 AC 2,239 ms
121,360 KB
testcase_25 AC 2,297 ms
121,624 KB
testcase_26 AC 2,254 ms
121,316 KB
testcase_27 AC 2,252 ms
121,268 KB
testcase_28 AC 2,230 ms
121,320 KB
testcase_29 AC 2,253 ms
121,672 KB
testcase_30 AC 2,366 ms
123,252 KB
testcase_31 AC 2,453 ms
124,260 KB
testcase_32 AC 2,424 ms
124,324 KB
testcase_33 AC 2,729 ms
122,428 KB
testcase_34 TLE -
testcase_35 AC 2,416 ms
123,276 KB
testcase_36 AC 2,452 ms
123,452 KB
testcase_37 AC 2,433 ms
123,216 KB
testcase_38 AC 2,506 ms
123,680 KB
testcase_39 AC 2,411 ms
122,936 KB
testcase_40 AC 2,409 ms
122,904 KB
testcase_41 AC 2,387 ms
123,076 KB
testcase_42 AC 2,260 ms
121,364 KB
testcase_43 AC 2,282 ms
121,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  vector<vector<int>> f(1000001);
  for (int i = 1; i <= 1000000; i++){
    for (int j = i * 2; j <= 1000000; j += i){
      f[j].push_back(i);
    }
  }
  vector<int> grundy(1000001, 0);
  for (int i = 2; i <= 1000000; i++){
    set<int> st;
    for (int j : f[i]){
      st.insert(grundy[j]);
    }
    while (st.count(grundy[i]) == 1){
      grundy[i]++;
    }
  }
  int X = 0;
  for (int i = 0; i < N; i++){
    X ^= grundy[A[i]];
  }
  if (X > 0){
    cout << "white" << endl;
  } else {
    cout << "black" << endl;
  }
}
0