結果

問題 No.22 括弧の対応
ユーザー Luoto-green
提出日時 2017-08-08 18:44:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 38 ms / 5,000 ms
コード長 247 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-20 07:25:12
合計ジャッジ時間 1,243 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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:
        a = A.pop()
        if i == m:
            ans = a 
        if a == m:
            ans = i
print(ans)
0