結果
| 問題 | No.3144 Parentheses Modification and Rotation (01 Ver.) |
| コンテスト | |
| ユーザー |
👑 potato167
|
| 提出日時 | 2025-05-16 21:40:44 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 2,000 ms |
| コード長 | 418 bytes |
| 記録 | |
| コンパイル時間 | 1,096 ms |
| コンパイル使用メモリ | 211,596 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-10 17:55:53 |
| 合計ジャッジ時間 | 3,051 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define all(p) p.begin(), p.end()
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
int main(){
int N;
cin >> N;
string S;
cin >> S;
int R, M;
cin >> R >> M;
if (N % 2){
cout << "-1\n";
}
else{
int tmp = 0;
for (auto c : S) tmp += (c == '(' ? -1 : 1);
cout << abs(tmp) / 2 << "\n";
}
}
potato167