結果

問題 No.3503 Brackets Stack Query 2
コンテスト
ユーザー irinoirino
提出日時 2026-04-09 09:55:43
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 654 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10,148 ms
コンパイル使用メモリ 335,336 KB
実行使用メモリ 20,196 KB
最終ジャッジ日時 2026-04-17 20:07:27
合計ジャッジ時間 24,183 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include "testlib.h"
using namespace std;

int main() {
    registerValidation();

    const int MAX_Q = 800000;

    int Q = inf.readInt(1, MAX_Q, "Q");
    inf.readEoln();

    int len = 0;

    for (int i = 0; i < Q; i++) {
        int type = inf.readInt(1, 2, "query type");

        if (type == 1) {
            inf.readChar(' ');
            inf.readToken("[(|)]", "c");
            inf.readEoln();
            len++;
        } else {
            if (len == 0) {
                quitf(_pe, "query %d: delete from empty string", i + 1);
            }
            inf.readEoln();
            len--;
        }
    }

    inf.readEof();
    return 0;
}
0