結果

問題 No.1579 New Type of Nim
ユーザー 👑 KazunKazun
提出日時 2021-07-02 21:32:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 630 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 71,540 KB
最終ジャッジ日時 2023-09-30 11:10:59
合計ジャッジ時間 4,117 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,244 KB
testcase_01 AC 71 ms
71,308 KB
testcase_02 AC 71 ms
71,540 KB
testcase_03 AC 73 ms
71,492 KB
testcase_04 AC 73 ms
71,280 KB
testcase_05 AC 73 ms
71,140 KB
testcase_06 AC 73 ms
71,288 KB
testcase_07 AC 74 ms
71,252 KB
testcase_08 AC 73 ms
71,220 KB
testcase_09 AC 72 ms
71,244 KB
testcase_10 AC 74 ms
71,412 KB
testcase_11 AC 74 ms
71,280 KB
testcase_12 AC 74 ms
71,252 KB
testcase_13 AC 74 ms
71,288 KB
testcase_14 AC 71 ms
71,284 KB
testcase_15 AC 73 ms
71,260 KB
testcase_16 AC 73 ms
71,288 KB
testcase_17 AC 73 ms
71,280 KB
testcase_18 AC 73 ms
71,264 KB
testcase_19 AC 71 ms
71,468 KB
testcase_20 AC 72 ms
71,292 KB
testcase_21 AC 73 ms
71,244 KB
testcase_22 AC 72 ms
71,256 KB
testcase_23 AC 73 ms
71,140 KB
testcase_24 AC 72 ms
71,132 KB
testcase_25 AC 73 ms
71,140 KB
testcase_26 AC 71 ms
71,400 KB
testcase_27 AC 73 ms
71,340 KB
testcase_28 AC 73 ms
71,420 KB
testcase_29 AC 72 ms
71,484 KB
testcase_30 AC 73 ms
71,320 KB
testcase_31 AC 73 ms
71,540 KB
testcase_32 AC 72 ms
71,276 KB
testcase_33 AC 71 ms
71,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""
from functools import lru_cache

@lru_cache(maxsize=1000)
def f(X,Y):
    if X==0 or Y==0:
        return 1

    F=0
    for a in range(1,X):
        if a==Y:
            F|=f(a,Y)
        else:
            F|=not f(a,Y)

    for b in range(1,Y):
        if X==b:
            F|=f(X,b)
        else:
            F|=not f(X,b)

    return F

K=30
T=[[0]*K for _ in range(K)]
for x in range(K):
    for y in range(K):
        if f(x,y):
            T[x][y]=1

for t in T:
    print(*t)
"""

X,Y=map(int,input().split())

if X==Y and X%2==1:
    print("Q")
elif abs(X-Y)==1 and min(X,Y)%2==1:
    print("Q")
else:
    print("P")
0