結果

問題 No.22 括弧の対応
ユーザー Luoto-greenLuoto-green
提出日時 2017-09-03 19:37:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 36 ms / 5,000 ms
コード長 241 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-20 07:25:28
合計ジャッジ時間 1,505 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
s = input()
A = []
for i,t in enumerate(s):
    i += 1
    if '(' == t:
        A.append(i)
    elif ')' == t:
        r = A.pop()
        if r == m:
            print(i)
        if i == m:
            print(r)
0