結果

問題 No.22 括弧の対応
ユーザー brthyyjpbrthyyjp
提出日時 2020-06-28 03:43:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 5,000 ms
コード長 294 bytes
コンパイル時間 1,784 ms
コンパイル使用メモリ 86,608 KB
実行使用メモリ 75,900 KB
最終ジャッジ日時 2023-09-27 13:48:07
合計ジャッジ時間 3,203 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,072 KB
testcase_01 AC 65 ms
71,280 KB
testcase_02 AC 64 ms
71,080 KB
testcase_03 AC 70 ms
75,800 KB
testcase_04 AC 68 ms
75,588 KB
testcase_05 AC 69 ms
75,444 KB
testcase_06 AC 71 ms
75,900 KB
testcase_07 AC 68 ms
75,756 KB
testcase_08 AC 66 ms
71,320 KB
testcase_09 AC 68 ms
75,876 KB
testcase_10 AC 65 ms
71,080 KB
testcase_11 AC 70 ms
75,436 KB
testcase_12 AC 70 ms
75,808 KB
testcase_13 AC 72 ms
75,876 KB
testcase_14 AC 66 ms
71,008 KB
testcase_15 AC 69 ms
75,808 KB
testcase_16 AC 69 ms
75,816 KB
testcase_17 AC 68 ms
71,164 KB
testcase_18 AC 66 ms
70,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
s = str(input())
d = []
for i in range(n):
    if s[i] == '(':
        d.append(i+1)
    else:
        if d[-1] == k:
            print(i+1)
            exit()
        elif i+1 == k:
            print(d[-1])
            exit()
        else:
            d.pop()
0