結果

問題 No.22 括弧の対応
ユーザー Luoto-greenLuoto-green
提出日時 2017-09-03 19:35:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 236 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-06 20:06:08
合計ジャッジ時間 1,580 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

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