結果
| 問題 |
No.3144 Parentheses Modification and Rotation (01 Ver.)
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2025-05-16 22:03:27 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 2,000 ms |
| コード長 | 252 bytes |
| コンパイル時間 | 358 ms |
| コンパイル使用メモリ | 12,160 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2025-10-28 13:27:41 |
| 合計ジャッジ時間 | 2,708 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
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)
titia