結果

問題 No.103 素因数ゲーム リターンズ
ユーザー むらためむらため
提出日時 2019-02-04 02:00:23
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 925 bytes
コンパイル時間 1,979 ms
コンパイル使用メモリ 66,120 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-14 03:25:22
合計ジャッジ時間 2,894 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 WA -
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 WA -
testcase_24 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 22) Warning: imported and not used: 'tables' [UnusedImport]

ソースコード

diff #

import sequtils,math,tables
template times*(n:int,body) = (for _ in 0..<n: body)
template `max=`*(x,y) = x = max(x,y)
template `min=`*(x,y) = x = min(x,y)

proc getFactorNumsAllRange(n:int):seq[seq[int]] =
  # 1 ~ n まで全ての素因数を列挙
  result = newSeqWith(n+1,newSeq[int]())
  for i in 2..n.float.sqrt.int :
    if result[i].len != 0: continue
    result[i] &= 1
    for j in countup(i*2,n,i):
      var t = 0
      var x = j
      while x mod i == 0:
        t += 1
        x = x div i
      result[j] &= t mod 3
const factors = getFactorNumsAllRange(10000).mapIt(it.foldl(a xor b,0))

proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  while true:
    let k = getchar_unlocked()
    if k < '0': return
    result = 10 * result + k.ord - '0'.ord

let n = scan()
var ans = 0
n.times: ans = ans xor factors[scan()]
if ans != 0 : echo "Alice"
else: echo "Bob"
0