結果
| 問題 |
No.3144 Parentheses Modification and Rotation (01 Ver.)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-16 22:31:37 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 56 ms / 2,000 ms |
| コード長 | 237 bytes |
| コンパイル時間 | 311 ms |
| コンパイル使用メモリ | 12,032 KB |
| 実行使用メモリ | 11,904 KB |
| 最終ジャッジ日時 | 2025-10-25 03:07:58 |
| 合計ジャッジ時間 | 3,004 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
N = int(input())
S = list(input())
R, M = map(int, input().split())
if N % 2:
print(-1)
else:
A = [(1 if S[i]== '(' else -1) for i in range(N)]
s = sum(A)
if s == 0:
print(0)
else:
print(abs(s) // 2)