結果

問題 No.2285 Make A Unit Square
ユーザー titia
提出日時 2023-04-30 01:13:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 309 ms / 2,000 ms
コード長 586 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-18 18:32:24
合計ジャッジ時間 2,107 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

GR=[0]*1000
def grundy(x):
    if x<=3:
        return 0
    SET=set()

    for i in range(2,x-1):
        SET.add(GR[i]^GR[x-i])

    for i in range(10000):
        if i in SET:
            True
        else:
            GR[x]=i
            return i

for i in range(1000):
    grundy(i)

def g(x):
    if x<1000:
        return GR[x]
    else:
        y=x//34
        return GR[x%34+2*34]

T=int(input())
for tests in range(T):
    a,b=map(int,input().split())

    if g(a)^g(b)!=0:
        print("First")
    else:
        print("Second")

    
0