結果
問題 | No.2 素因数ゲーム |
ユーザー | asumo0729 |
提出日時 | 2023-01-18 18:00:28 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,559 bytes |
コンパイル時間 | 576 ms |
コンパイル使用メモリ | 87,016 KB |
実行使用メモリ | 77,928 KB |
最終ジャッジ日時 | 2023-09-02 12:16:43 |
合計ジャッジ時間 | 5,969 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 119 ms
72,604 KB |
testcase_01 | AC | 113 ms
72,816 KB |
testcase_02 | AC | 118 ms
72,844 KB |
testcase_03 | AC | 120 ms
72,588 KB |
testcase_04 | WA | - |
testcase_05 | AC | 117 ms
72,728 KB |
testcase_06 | AC | 120 ms
77,156 KB |
testcase_07 | AC | 119 ms
77,452 KB |
testcase_08 | WA | - |
testcase_09 | AC | 126 ms
77,340 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 127 ms
77,296 KB |
testcase_13 | AC | 125 ms
77,928 KB |
testcase_14 | AC | 123 ms
77,404 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 122 ms
77,344 KB |
testcase_18 | AC | 117 ms
77,084 KB |
testcase_19 | AC | 118 ms
77,352 KB |
testcase_20 | WA | - |
testcase_21 | AC | 122 ms
77,344 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 122 ms
77,072 KB |
testcase_27 | AC | 123 ms
77,332 KB |
testcase_28 | AC | 129 ms
77,540 KB |
testcase_29 | AC | 126 ms
77,452 KB |
testcase_30 | WA | - |
ソースコード
import sys from operator import itemgetter from collections import defaultdict, deque import heapq from heapq import heapify, heappop, _heapify_max, heappush from bisect import bisect_left, bisect_right import math import itertools import copy stdin=sys.stdin #sys.setrecursionlimit(10 ** 7) #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') ip=lambda: int(sp()) fp=lambda: float(sp()) lp=lambda:list(map(int,stdin.readline().split())) sp=lambda:stdin.readline().rstrip() Yp=lambda:print('Yes') Np=lambda:print('No') inf = 1 << 60 mod = 10 ** 9 + 7 mod = 998244353 eps = 1e-9 sortkey1 = itemgetter(0) sortkey2 = lambda x: (x[0], x[1]) # sort(key=lambda x:(x[1], x[2])) ############################################################### N = ip() NN = N factors = set() soin = set() for i in range(2, N + 1): if i * i > N: break if N % i == 0: factors.add(i) factors.add(N//i) if NN % i == 0: soin.add(i) while NN % i == 0: NN //= i NN = N for f in soin: if NN % f == 0: NN //= f if NN == N: soin.add(N) factors.add(N) factors = list(factors) factors.sort() grundy = defaultdict(int) grundy[1] = 0 for fac in factors: mex = set() for f in soin: if fac % f == 0: ffac = fac while ffac % f == 0: mex.add(grundy[ffac//f]) ffac //= f for i in range(1000): if i not in mex: x = i break grundy[fac] = x if grundy[N]: print('Alice') else: print('Bob')