結果

問題 No.2285 Make A Unit Square
ユーザー titiatitia
提出日時 2023-04-30 01:13:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 309 ms / 2,000 ms
コード長 586 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-29 14:23:47
合計ジャッジ時間 2,312 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
10,752 KB
testcase_01 AC 85 ms
10,624 KB
testcase_02 AC 309 ms
10,752 KB
testcase_03 AC 308 ms
10,752 KB
testcase_04 AC 261 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

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