結果

問題 No.22 括弧の対応
ユーザー tabataba
提出日時 2016-04-13 05:30:34
言語 Python2
(2.7.18)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 197 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 6,596 KB
実行使用メモリ 6,324 KB
最終ジャッジ日時 2023-09-27 13:03:51
合計ジャッジ時間 1,132 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
5,944 KB
testcase_01 AC 9 ms
5,920 KB
testcase_02 AC 9 ms
5,844 KB
testcase_03 AC 10 ms
6,160 KB
testcase_04 AC 9 ms
6,136 KB
testcase_05 AC 10 ms
6,152 KB
testcase_06 AC 10 ms
6,052 KB
testcase_07 AC 9 ms
6,112 KB
testcase_08 AC 9 ms
6,084 KB
testcase_09 AC 10 ms
6,068 KB
testcase_10 AC 9 ms
6,148 KB
testcase_11 AC 10 ms
6,212 KB
testcase_12 AC 10 ms
6,136 KB
testcase_13 AC 11 ms
6,088 KB
testcase_14 AC 9 ms
5,896 KB
testcase_15 AC 10 ms
6,252 KB
testcase_16 AC 9 ms
6,324 KB
testcase_17 AC 9 ms
5,888 KB
testcase_18 AC 9 ms
5,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,raw_input().split())
s=raw_input()
t=[]
u=[]
for i in range(n):
	if s[i]=="(":
		t.append(i)
	else:
		j=t.pop()
		if i+1==k:
			print j+1
			exit()
		elif j+1==k:
			print i+1
			exit()
0