結果

問題 No.684 Prefix Parenthesis
ユーザー gew1fw
提出日時 2025-06-12 19:16:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 191 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 82,704 KB
実行使用メモリ 69,412 KB
最終ジャッジ日時 2025-06-12 19:16:39
合計ジャッジ時間 2,364 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

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

total = 0
left = 0
right = 0

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

print(total * 2)
0