結果

問題 No.726 Tree Game
ユーザー silversmithsilversmith
提出日時 2018-11-23 10:14:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 935 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 10,976 KB
実行使用メモリ 8,932 KB
最終ジャッジ日時 2023-08-26 04:08:28
合計ジャッジ時間 1,759 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,720 KB
testcase_01 AC 22 ms
8,720 KB
testcase_02 AC 22 ms
8,892 KB
testcase_03 AC 22 ms
8,872 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 21 ms
8,836 KB
testcase_08 WA -
testcase_09 AC 20 ms
8,724 KB
testcase_10 AC 20 ms
8,812 KB
testcase_11 AC 19 ms
8,888 KB
testcase_12 AC 19 ms
8,872 KB
testcase_13 AC 19 ms
8,724 KB
testcase_14 AC 20 ms
8,704 KB
testcase_15 AC 19 ms
8,828 KB
testcase_16 WA -
testcase_17 AC 20 ms
8,808 KB
testcase_18 WA -
testcase_19 AC 20 ms
8,708 KB
testcase_20 AC 20 ms
8,816 KB
testcase_21 AC 20 ms
8,724 KB
testcase_22 AC 20 ms
8,704 KB
testcase_23 AC 20 ms
8,724 KB
testcase_24 AC 20 ms
8,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import bisect
#x未満の素数
def primes(x):
	if x<2: return []
	input_list=[False if i % 2==0 or i % 3 ==0 or i % 5 == 0 else True for i in range(x)]
	input_list[0] = input_list[1] = False
	if x>2: input_list[2]=True
	if x>3: input_list[3]=True
	if x>5: input_list[5]=True
	
	sqrt = math.sqrt(x)

	for prime in range(3,x,2):
		if prime>=sqrt:
			break
		if not input_list[prime]:
			continue
		for s in range(prime ** 2,x,prime):
			input_list[s]=False

	return [i for i, b in enumerate(input_list) if b == True]

x,y=input().split()
x=int(x)
y=int(y)

p=primes(int(math.sqrt(10**9))+1)

def ans(x,y):
	flag=True
	x,y=min(x,y),max(x,y)
	if x==1:
		if y==1 or y==2:
			return flag
		else:
			x+=1
			#flag = not flag
	if x==2:
		if y==1 or y==2:
			return flag
		else:
			x+=1
			#flag = not flag

	if x%2 + y%2 ==1:
		flag = not flag
	else:
		flag=flag

	return flag

if ans(x,y):
	print("Second")
else:
	print("First")
0