結果
| 問題 | 
                            No.726 Tree Game
                             | 
                    
| コンテスト | |
| ユーザー | 
                             nadare
                         | 
                    
| 提出日時 | 2018-08-24 22:14:11 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 839 bytes | 
| コンパイル時間 | 637 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 11,392 KB | 
| 最終ジャッジ日時 | 2024-06-23 07:44:09 | 
| 合計ジャッジ時間 | 1,977 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 23 WA * 2 | 
ソースコード
# -*- coding: utf-8 -*-
from bisect import bisect, bisect_left
from math import sqrt
def primes(N):
    sieve = [True]*(N+1)
    sieve[:2] = [False, False]
    P = []
    
    for i in range(2, N):
        if sieve[i]:
            P.append(i)
            for j in range(2*i, N, i):
                sieve[j] = False
    return P
def isprime(X, P):
    if X <= P[-1]:
        return X == P[bisect_left(P, X)]
    for p in P[:bisect(P, sqrt(X)+1)]:
        if X%p == 0:
            return False
    else:
        return True
P = primes(int(sqrt(2*10**9)))
X, Y = map(int, input().split())
secwin = True
i = 0
while (not isprime(X, P)) or (i==0):
    i += 1
    X += 1
    secwin = not secwin
i = 0
while (not isprime(Y, P)) or (i==0):
    i += 1
    Y += 1
    secwin = not secwin
if secwin:
    print("Second")
else:
    print("First")
            
            
            
        
            
nadare