結果

問題 No.103 素因数ゲーム リターンズ
ユーザー 👑 colognecologne
提出日時 2022-02-02 16:23:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 566 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 76,932 KB
最終ジャッジ日時 2023-09-02 02:50:36
合計ジャッジ時間 4,440 ms
ジャッジサーバーID
(参考情報)
judge16 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
72,480 KB
testcase_01 AC 108 ms
72,280 KB
testcase_02 AC 107 ms
72,700 KB
testcase_03 AC 106 ms
72,528 KB
testcase_04 AC 107 ms
72,464 KB
testcase_05 AC 106 ms
72,568 KB
testcase_06 AC 107 ms
72,524 KB
testcase_07 AC 106 ms
72,504 KB
testcase_08 AC 108 ms
72,688 KB
testcase_09 AC 107 ms
72,800 KB
testcase_10 AC 109 ms
72,716 KB
testcase_11 AC 107 ms
72,460 KB
testcase_12 AC 108 ms
72,668 KB
testcase_13 AC 112 ms
76,808 KB
testcase_14 AC 113 ms
76,852 KB
testcase_15 AC 112 ms
76,932 KB
testcase_16 AC 111 ms
72,668 KB
testcase_17 AC 112 ms
76,748 KB
testcase_18 AC 111 ms
72,468 KB
testcase_19 AC 115 ms
76,796 KB
testcase_20 AC 112 ms
72,492 KB
testcase_21 AC 111 ms
72,812 KB
testcase_22 AC 111 ms
72,500 KB
testcase_23 AC 109 ms
72,296 KB
testcase_24 AC 110 ms
72,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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()
0