結果

問題 No.22 括弧の対応
ユーザー irisAsh
提出日時 2024-05-06 18:52:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 209 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-29 04:11:28
合計ジャッジ時間 1,720 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int, input().split())
S=input()
if S[K-1]=='(':
    a=S[K:]
    c=')'
else:
    a=S[:K][::-1]
    c='('
w=1
n=0
for x in S[K:]:
    n+=1
    w+=(-1 if x==c else 1)
    if w==0:
        break
print(n+K)
0