結果

問題 No.22 括弧の対応
ユーザー Maboy
提出日時 2017-05-02 11:27:09
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 177 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-14 04:40:51
合計ジャッジ時間 1,518 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

def a(s):
    return 1 if s!=")" else -1

N,K=map(int,input().split())
S=input()

s=K-1
t=a(S[s])
e=s+t
c=0
while 1:
    c+=a(S[e])
    e+=t
    if c==-1:
        break
print(e)
0