結果

問題 No.684 Prefix Parenthesis
ユーザー lam6er
提出日時 2025-03-20 20:56:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 218 bytes
コンパイル時間 852 ms
コンパイル使用メモリ 81,916 KB
実行使用メモリ 69,320 KB
最終ジャッジ日時 2025-03-20 20:56:49
合計ジャッジ時間 2,788 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input().strip()

total = 0
current_l = 0
current_r = 0

for c in s:
    if c == '(':
        current_l += 1
    else:
        current_r += 1
    total += min(current_l, current_r)

print(total * 2)
0