結果

問題 No.3144 Parentheses Modification and Rotation (01 Ver.)
ユーザー norioc
提出日時 2025-05-17 03:15:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 246 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 82,660 KB
実行使用メモリ 54,084 KB
最終ジャッジ日時 2025-06-29 17:14:34
合計ジャッジ時間 3,050 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
R, M = map(int, input().split())


def solve():
    if N % 2 == 1: return -1

    lt = S.count('(')
    rt = S.count(')')
    if lt == rt:
        return 0

    return abs(lt - rt) * M // 2


ans = solve()
print(ans)
0