結果

問題 No.684 Prefix Parenthesis
ユーザー kerotonokerotono
提出日時 2018-05-12 00:12:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 198 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 10,656 KB
実行使用メモリ 8,488 KB
最終ジャッジ日時 2023-09-10 18:00:51
合計ジャッジ時間 2,626 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 16 ms
7,868 KB
testcase_02 AC 16 ms
7,860 KB
testcase_03 AC 26 ms
7,816 KB
testcase_04 AC 37 ms
8,352 KB
testcase_05 AC 41 ms
8,276 KB
testcase_06 AC 25 ms
7,912 KB
testcase_07 WA -
testcase_08 AC 19 ms
7,868 KB
testcase_09 WA -
testcase_10 AC 50 ms
8,256 KB
testcase_11 WA -
testcase_12 AC 21 ms
7,820 KB
testcase_13 AC 50 ms
8,316 KB
testcase_14 AC 48 ms
8,304 KB
testcase_15 AC 28 ms
7,776 KB
testcase_16 AC 45 ms
8,320 KB
testcase_17 AC 32 ms
8,360 KB
testcase_18 AC 17 ms
7,908 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 50 ms
8,312 KB
testcase_22 AC 46 ms
8,448 KB
testcase_23 AC 49 ms
8,288 KB
testcase_24 AC 50 ms
8,296 KB
testcase_25 AC 51 ms
8,392 KB
testcase_26 AC 17 ms
7,912 KB
testcase_27 AC 16 ms
7,804 KB
testcase_28 AC 16 ms
7,908 KB
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!python
# -*- coding: utf-8 -*-

N = int(input())
S = input()

R = 0
L = 0
for i, c in enumerate(S):
    if c == '(':
        L += len(S) - i
    else:
        R += len(S) - i
print(min(R, L) * 2)
0