結果

問題 No.22 括弧の対応
ユーザー matriematrie
提出日時 2020-12-12 19:45:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 113 ms / 5,000 ms
コード長 195 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 11,928 KB
実行使用メモリ 10,692 KB
最終ジャッジ日時 2023-10-20 02:10:08
合計ジャッジ時間 2,479 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,100 KB
testcase_01 AC 29 ms
10,100 KB
testcase_02 AC 29 ms
10,100 KB
testcase_03 AC 113 ms
10,692 KB
testcase_04 AC 47 ms
10,356 KB
testcase_05 AC 43 ms
10,340 KB
testcase_06 AC 79 ms
10,492 KB
testcase_07 AC 61 ms
10,576 KB
testcase_08 AC 37 ms
10,428 KB
testcase_09 AC 63 ms
10,396 KB
testcase_10 AC 47 ms
10,552 KB
testcase_11 AC 43 ms
10,332 KB
testcase_12 AC 65 ms
10,436 KB
testcase_13 AC 112 ms
10,576 KB
testcase_14 AC 31 ms
10,160 KB
testcase_15 AC 92 ms
10,628 KB
testcase_16 AC 109 ms
10,636 KB
testcase_17 AC 29 ms
10,100 KB
testcase_18 AC 29 ms
10,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
s=input()
l=list(range(1,n+1))

while(len(s)>0):
	x=s.find("()")
	if l[x]==k: print(l[x+1]); break
	if l[x+1]==k: print(l[x]); break
	s=s[:x]+s[x+2:]
	l=l[:x]+l[x+2:]
0