結果
問題 | No.2 素因数ゲーム |
ユーザー | 👑 cologne |
提出日時 | 2022-01-20 15:09:00 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 81 ms / 5,000 ms |
コード長 | 822 bytes |
コンパイル時間 | 559 ms |
コンパイル使用メモリ | 87,204 KB |
実行使用メモリ | 75,820 KB |
最終ジャッジ日時 | 2023-08-15 12:33:34 |
合計ジャッジ時間 | 4,686 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
71,356 KB |
testcase_01 | AC | 74 ms
71,552 KB |
testcase_02 | AC | 74 ms
71,492 KB |
testcase_03 | AC | 76 ms
71,696 KB |
testcase_04 | AC | 76 ms
71,612 KB |
testcase_05 | AC | 73 ms
71,532 KB |
testcase_06 | AC | 75 ms
71,480 KB |
testcase_07 | AC | 76 ms
71,412 KB |
testcase_08 | AC | 79 ms
75,712 KB |
testcase_09 | AC | 78 ms
71,612 KB |
testcase_10 | AC | 79 ms
75,732 KB |
testcase_11 | AC | 76 ms
71,628 KB |
testcase_12 | AC | 74 ms
71,512 KB |
testcase_13 | AC | 75 ms
71,544 KB |
testcase_14 | AC | 75 ms
71,548 KB |
testcase_15 | AC | 79 ms
75,708 KB |
testcase_16 | AC | 78 ms
75,580 KB |
testcase_17 | AC | 81 ms
75,688 KB |
testcase_18 | AC | 76 ms
71,408 KB |
testcase_19 | AC | 79 ms
75,700 KB |
testcase_20 | AC | 78 ms
75,756 KB |
testcase_21 | AC | 77 ms
75,760 KB |
testcase_22 | AC | 79 ms
75,512 KB |
testcase_23 | AC | 76 ms
71,292 KB |
testcase_24 | AC | 80 ms
75,708 KB |
testcase_25 | AC | 80 ms
75,820 KB |
testcase_26 | AC | 78 ms
71,636 KB |
testcase_27 | AC | 77 ms
71,380 KB |
testcase_28 | AC | 74 ms
71,288 KB |
testcase_29 | AC | 76 ms
71,532 KB |
testcase_30 | AC | 79 ms
75,812 KB |
ソースコード
import sys import itertools input = sys.stdin.readline def main(): N = int(input()) memo = {1: False} def check(x, i): while x % i == 0: x //= i if not solve(x): return True return False def solve(x): if x in memo: return memo[x] y = x for i in itertools.count(2): if i*i > y: break if y % i == 0: if check(x, i): memo[x] = True return True while y % i == 0: y //= i if y != 1 and check(x, y): memo[x] = True return True memo[x] = False return False print('Alice' if solve(N) else 'Bob') if __name__ == '__main__': main()