結果
問題 |
No.2285 Make A Unit Square
|
ユーザー |
|
提出日時 | 2024-04-29 21:32:59 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 329 ms / 2,000 ms |
コード長 | 638 bytes |
コンパイル時間 | 184 ms |
コンパイル使用メモリ | 82,280 KB |
実行使用メモリ | 78,084 KB |
最終ジャッジ日時 | 2024-11-19 05:38:24 |
合計ジャッジ時間 | 2,259 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 |
ソースコード
memo = {} def f(n): if n == 2 or n == 3: return 0 if n in memo: return memo[n] se = set() for i in range(2, n): j = n - i if i > j: break se.add(f(i) ^ f(j)) mex = 0 while mex in se: mex += 1 memo[n] = mex return mex G = [0, 0] for n in range(2, 102): G.append(f(n)) def g(n): minus = max(0, (n - 102) // 34 * 34) n -= minus while n >= len(G): n -= 34 return G[n] for _ in range(int(input())): a, b = map(int, input().split()) if g(a) != g(b): print("First") else: print("Second")