結果

問題 No.684 Prefix Parenthesis
コンテスト
ユーザー lam6er
提出日時 2025-03-20 20:56:23
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 218 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 275 ms
コンパイル使用メモリ 96,232 KB
実行使用メモリ 83,800 KB
最終ジャッジ日時 2026-07-07 12:23:18
合計ジャッジ時間 4,379 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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