結果

問題 No.1665 quotient replace
ユーザー tnakao0123tnakao0123
提出日時 2021-09-04 15:21:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,013 bytes
コンパイル時間 2,016 ms
コンパイル使用メモリ 91,612 KB
実行使用メモリ 7,544 KB
最終ジャッジ日時 2023-08-22 23:41:46
合計ジャッジ時間 30,901 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 6 ms
5,316 KB
testcase_04 AC 7 ms
5,448 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 30 ms
7,228 KB
testcase_07 AC 8 ms
6,340 KB
testcase_08 AC 19 ms
7,276 KB
testcase_09 AC 88 ms
7,320 KB
testcase_10 AC 816 ms
7,300 KB
testcase_11 AC 1,518 ms
7,244 KB
testcase_12 AC 219 ms
7,296 KB
testcase_13 AC 1,813 ms
7,300 KB
testcase_14 AC 1,808 ms
7,308 KB
testcase_15 AC 1,820 ms
7,372 KB
testcase_16 AC 1,833 ms
7,372 KB
testcase_17 AC 1,809 ms
7,248 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 10 ms
6,884 KB
testcase_27 AC 22 ms
7,240 KB
testcase_28 AC 71 ms
7,296 KB
testcase_29 AC 120 ms
7,224 KB
testcase_30 AC 254 ms
7,296 KB
testcase_31 AC 283 ms
7,292 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 2 ms
4,384 KB
testcase_43 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1665.cc:  No.1665 quotient replace - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 1000000;
const int MAX_A = 1000000;

/* typedef */

/* global variables */

int cache[MAX_A + 1];

/* subroutines */

int countdiv(int a) {
  if (cache[a] > 0) return cache[a];

  int c = 0;
  for (int p = 1; p * p <= a; p++)
    if (a % p == 0) {
      int q = a / p;
      c += (p != q) ? 2 : 1;
    }
  return (cache[a] = c);
}

/* main */

int main() {
  int n;
  scanf("%d", &n);

  int nim = 0;
  for (int i = 0; i < n; i++) {
    int ai;
    scanf("%d", &ai);
    nim ^= countdiv(ai) - 1;
  }

  if (nim) puts("white");
  else puts("black");
  return 0;
}

0