結果

問題 No.3144 Parentheses Modification and Rotation (01 Ver.)
ユーザー 👑 potato167
提出日時 2025-05-16 21:40:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 418 bytes
コンパイル時間 1,912 ms
コンパイル使用メモリ 191,728 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-05-16 21:40:47
合計ジャッジ時間 2,989 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

#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";
    }
}
0