結果
| 問題 |
No.726 Tree Game
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-23 15:25:22 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,015 bytes |
| コンパイル時間 | 442 ms |
| コンパイル使用メモリ | 82,112 KB |
| 実行使用メモリ | 246,488 KB |
| 最終ジャッジ日時 | 2024-06-24 12:11:39 |
| 合計ジャッジ時間 | 9,132 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 WA * 3 |
ソースコード
# n以上の素数で最小のものを返す
def eratosthenes0(n):
nu=n+min(n,10**6)
kouho=set(range(n,nu))
for x in range(2,int(nu**.5)+1):
xx=x*(n//x)
while xx<nu:
kouho.discard(xx)
xx+=x
return min(kouho)
def main(x0,y0):
if x0>y0:x0,y0=y0,x0
x1=eratosthenes0(x0)
y1=eratosthenes0(y0)
if x0==1 and y0==1:
return False
elif x0==1 or y0==1:
# x0が1
y1=eratosthenes0(y0+1) # y0より真に大きい素数
if (y1-y0)%2==0:
return True
else:
return False
elif x0==2 or y0==2:
# (2,8)->(2,9) ng
# (2,8)->(3,8) ng
return False
elif x0==x1 and y0==y1:
return False
elif x0==x1 or y0==y1:
# 素数の座標を動かす
if x0==x1:
return not main(x0+1,y0)
else:
return not main(x0,y0+1)
else:
if (x1-x0)+(y1-y0) % 2 == 0:
return True
else:
return False
if __name__=='__main__':
x,y=map(int,input().split())
ret=main(x,y)
if ret:
print("First")
else:
print("Second")