結果
| 問題 | No.103 素因数ゲーム リターンズ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-02-04 02:00:40 |
| 言語 | Nim (2.2.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 925 bytes |
| コンパイル時間 | 2,280 ms |
| コンパイル使用メモリ | 60,976 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-01 11:19:29 |
| 合計ジャッジ時間 | 3,061 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 16 WA * 4 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 22) Warning: imported and not used: 'tables' [UnusedImport]
ソースコード
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(10010).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"