結果

問題 No.1579 New Type of Nim
コンテスト
ユーザー 👑 SPD_9X2
提出日時 2021-07-02 21:50:08
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 954 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 157 ms
コンパイル使用メモリ 85,368 KB
実行使用メモリ 53,652 KB
最終ジャッジ日時 2026-04-03 12:45:52
合計ジャッジ時間 1,796 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

"""

Xorを0にするともう一回操作することになる
つまり、同じにはできない



"""

A,B = map(int,input().split())

if A == B:
    if A % 2 == 1:
        print ("Q")
    else:
        print ("P")
elif abs(A-B) == 1:
    if min(A,B) % 2 == 1:
        print ("Q")
    else:
        print ("P")
else:
    print ("P")

#test
"""
ans = {}
ans[(0,0)] = 0

for l in range(10):
    for r in range(10):

        s = set()
        for nexl in range(l):
            if nexl != r or (nexl,r) == (0,0):
                s.add(ans[(nexl,r)])

        for nexr in range(r):
            if nexr != l or (l,nexr) == (0,0):
                s.add(ans[(l,nexr)])

        if l <= r:
            for nexl in range(l):
                s.add(ans[(nexl,l)])
        if l >= r:
            for nexr in range(r):
                s.add(ans[(r,nexr)])

        mex = 0
        while mex in s:
            mex += 1

        ans[(l,r)] = mex

print (ans)
"""
0