結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
8,652 KB
testcase_01 AC 23 ms
8,704 KB
testcase_02 AC 22 ms
8,680 KB
testcase_03 AC 22 ms
8,808 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 23 ms
8,620 KB
testcase_09 WA -
testcase_10 AC 23 ms
8,648 KB
testcase_11 AC 22 ms
8,676 KB
testcase_12 AC 22 ms
8,812 KB
testcase_13 AC 23 ms
8,748 KB
testcase_14 AC 25 ms
8,808 KB
testcase_15 AC 23 ms
8,776 KB
testcase_16 WA -
testcase_17 AC 23 ms
8,692 KB
testcase_18 AC 22 ms
8,648 KB
testcase_19 AC 23 ms
8,764 KB
testcase_20 AC 22 ms
8,812 KB
testcase_21 AC 22 ms
8,688 KB
testcase_22 AC 23 ms
8,716 KB
testcase_23 AC 22 ms
8,776 KB
testcase_24 AC 22 ms
8,672 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