結果
| 問題 |
No.103 素因数ゲーム リターンズ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-02 16:23:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 54 ms / 5,000 ms |
| コード長 | 566 bytes |
| コンパイル時間 | 163 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 60,928 KB |
| 最終ジャッジ日時 | 2024-06-11 09:28:24 |
| 合計ジャッジ時間 | 2,408 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 20 |
ソースコード
import operator
import functools
import sys
import itertools
input = sys.stdin.readline
def grundy(N):
a = 0
for i in itertools.count(2):
if i*i > N:
break
c = 0
while N % i == 0:
N //= i
c += 1
a ^= c % 3
if N != 1:
a ^= 1
return a
def main():
int(input()) # N
print('Alice' if
functools.reduce(operator.xor, map(lambda x: grundy(int(x)),
input().split()))
else 'Bob')
if __name__ == '__main__':
main()