結果

問題 No.2539 スライムゲーム
ユーザー 👑 p-adicp-adic
提出日時 2023-09-28 08:33:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 445 ms / 1,000 ms
コード長 356 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 10,112 KB
最終ジャッジ日時 2023-11-10 20:50:11
合計ジャッジ時間 6,904 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,984 KB
testcase_01 AC 30 ms
9,984 KB
testcase_02 AC 31 ms
9,984 KB
testcase_03 AC 31 ms
9,984 KB
testcase_04 AC 30 ms
9,984 KB
testcase_05 AC 30 ms
9,984 KB
testcase_06 AC 29 ms
9,984 KB
testcase_07 AC 28 ms
9,984 KB
testcase_08 AC 29 ms
9,984 KB
testcase_09 AC 30 ms
9,984 KB
testcase_10 AC 29 ms
9,984 KB
testcase_11 AC 29 ms
9,984 KB
testcase_12 AC 29 ms
9,984 KB
testcase_13 AC 30 ms
9,984 KB
testcase_14 AC 29 ms
9,984 KB
testcase_15 AC 31 ms
9,984 KB
testcase_16 AC 30 ms
9,984 KB
testcase_17 AC 29 ms
9,984 KB
testcase_18 AC 30 ms
9,984 KB
testcase_19 AC 29 ms
9,984 KB
testcase_20 AC 30 ms
9,984 KB
testcase_21 AC 31 ms
9,984 KB
testcase_22 AC 29 ms
9,984 KB
testcase_23 AC 30 ms
9,984 KB
testcase_24 AC 29 ms
9,984 KB
testcase_25 AC 29 ms
9,984 KB
testcase_26 AC 29 ms
9,984 KB
testcase_27 AC 30 ms
9,984 KB
testcase_28 AC 134 ms
10,112 KB
testcase_29 AC 167 ms
10,112 KB
testcase_30 AC 440 ms
10,112 KB
testcase_31 AC 29 ms
10,112 KB
testcase_32 AC 44 ms
10,112 KB
testcase_33 AC 99 ms
10,112 KB
testcase_34 AC 183 ms
10,112 KB
testcase_35 AC 29 ms
10,112 KB
testcase_36 AC 193 ms
10,112 KB
testcase_37 AC 193 ms
10,112 KB
testcase_38 AC 441 ms
10,112 KB
testcase_39 AC 440 ms
10,112 KB
testcase_40 AC 438 ms
10,112 KB
testcase_41 AC 439 ms
10,112 KB
testcase_42 AC 445 ms
10,112 KB
testcase_43 AC 416 ms
10,112 KB
testcase_44 AC 440 ms
10,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
def H(l,r,M):
	a=0
	while l<r:
		if M<1:return -1
		f,d=0,1
		if S[r-1]>'(':
			for m in range(r-2,l-1,-1):
				d+=(S[m]>'(')*2-1
				if d<1:
					e,p=0,1
					while p*2<=M:p,e=p*2,e+1
					e,r,f=H(m+1,r-1,e),m,1
					if e<0:return e
					a,M=a+(1<<e),M-(1<<e)
					break
		if f<1:return a+1
	return a
a=H(0,len(S),10**18)
print([a,"INFTY"][a<0])
0