結果
| 問題 | No.684 Prefix Parenthesis |
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 19:34:55 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 187 bytes |
| コンパイル時間 | 278 ms |
| コンパイル使用メモリ | 82,352 KB |
| 実行使用メモリ | 63,304 KB |
| 最終ジャッジ日時 | 2025-06-12 19:35:09 |
| 合計ジャッジ時間 | 2,456 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 WA * 17 |
ソースコード
n = int(input())
s = input().strip()
total = 0
count = 0
for i in range(n):
if s[i] == '(':
count += 1
l = count
r = i + 1 - l
total += 2 * min(l, r)
print(total)
gew1fw