結果

問題 No.2539 スライムゲーム
ユーザー 👑 p-adicp-adic
提出日時 2023-09-28 08:41:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 1,000 ms
コード長 356 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 75,656 KB
最終ジャッジ日時 2023-11-10 20:50:05
合計ジャッジ時間 4,665 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 37 ms
53,460 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 AC 37 ms
53,460 KB
testcase_07 AC 37 ms
53,460 KB
testcase_08 AC 38 ms
53,460 KB
testcase_09 AC 38 ms
53,460 KB
testcase_10 AC 37 ms
53,460 KB
testcase_11 AC 38 ms
53,460 KB
testcase_12 AC 37 ms
53,460 KB
testcase_13 AC 39 ms
53,460 KB
testcase_14 AC 38 ms
53,460 KB
testcase_15 AC 37 ms
53,460 KB
testcase_16 AC 38 ms
53,460 KB
testcase_17 AC 37 ms
53,460 KB
testcase_18 AC 37 ms
53,460 KB
testcase_19 AC 37 ms
53,460 KB
testcase_20 AC 38 ms
53,460 KB
testcase_21 AC 43 ms
59,468 KB
testcase_22 AC 42 ms
59,468 KB
testcase_23 AC 37 ms
53,460 KB
testcase_24 AC 42 ms
59,468 KB
testcase_25 AC 36 ms
53,460 KB
testcase_26 AC 37 ms
53,460 KB
testcase_27 AC 37 ms
53,460 KB
testcase_28 AC 75 ms
75,528 KB
testcase_29 AC 75 ms
75,648 KB
testcase_30 AC 52 ms
68,236 KB
testcase_31 AC 37 ms
53,460 KB
testcase_32 AC 41 ms
61,572 KB
testcase_33 AC 53 ms
74,764 KB
testcase_34 AC 68 ms
75,468 KB
testcase_35 AC 37 ms
53,460 KB
testcase_36 AC 75 ms
75,652 KB
testcase_37 AC 77 ms
75,656 KB
testcase_38 AC 52 ms
68,236 KB
testcase_39 AC 55 ms
70,164 KB
testcase_40 AC 55 ms
70,164 KB
testcase_41 AC 56 ms
70,172 KB
testcase_42 AC 55 ms
70,172 KB
testcase_43 AC 52 ms
68,236 KB
testcase_44 AC 51 ms
68,236 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