結果

問題 No.3144 Parentheses Modification and Rotation (01 Ver.)
コンテスト
ユーザー titia
提出日時 2025-05-16 22:03:27
言語 Python3
(3.14.2 + numpy 2.4.0 + scipy 1.16.3)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 252 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 238 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2025-11-04 18:28:10
合計ジャッジ時間 3,906 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline

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

if N%2!=0:
    print(-1)
    exit()


x=0
y=0

for s in S:
    if s=="(":
        x+=1
    else:
        y+=1

ANS=(max(x,y)-min(x,y))//2

print(ANS)
0