結果

問題 No.726 Tree Game
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-06-23 15:20:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,015 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 258,312 KB
最終ジャッジ日時 2023-09-06 17:40:49
合計ジャッジ時間 10,181 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,848 KB
testcase_01 AC 73 ms
71,804 KB
testcase_02 AC 74 ms
71,660 KB
testcase_03 AC 73 ms
71,816 KB
testcase_04 AC 72 ms
71,736 KB
testcase_05 AC 72 ms
71,728 KB
testcase_06 AC 72 ms
71,736 KB
testcase_07 AC 80 ms
71,640 KB
testcase_08 AC 73 ms
71,864 KB
testcase_09 AC 70 ms
71,720 KB
testcase_10 AC 72 ms
71,844 KB
testcase_11 WA -
testcase_12 AC 73 ms
71,720 KB
testcase_13 AC 71 ms
71,740 KB
testcase_14 AC 72 ms
71,624 KB
testcase_15 AC 72 ms
71,504 KB
testcase_16 AC 805 ms
257,468 KB
testcase_17 AC 765 ms
257,440 KB
testcase_18 AC 428 ms
244,212 KB
testcase_19 WA -
testcase_20 AC 779 ms
257,292 KB
testcase_21 AC 758 ms
258,312 KB
testcase_22 WA -
testcase_23 AC 752 ms
258,312 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 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")
0