結果

問題 No.22 括弧の対応
ユーザー excnct
提出日時 2024-12-18 17:18:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 328 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-18 17:19:00
合計ジャッジ時間 1,908 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 RE * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n, k = [int(x) for x in input().split(" ")]
    s = list(input())
    l = []

    for i in range(len(s) - 1):
        if i + 1 > k and len(l) == k:
            ans = i + 1

        if s[i] == "(":
            l.append(s[i])
        else:
            l.pop()

    print(ans)

if __name__ == "__main__":
    main()
0