結果
| 問題 | No.3144 Parentheses Modification and Rotation (01 Ver.) |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2025-05-16 22:03:27 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 105 ms / 2,000 ms |
| + 944µs | |
| コード長 | 252 bytes |
| 記録 | |
| コンパイル時間 | 308 ms |
| コンパイル使用メモリ | 21,540 KB |
| 実行使用メモリ | 15,872 KB |
| 最終ジャッジ日時 | 2026-07-16 07:43:53 |
| 合計ジャッジ時間 | 6,672 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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