結果

問題 No.3086 Re One Two
ユーザー GOTKAKO
提出日時 2025-04-04 21:31:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 628 bytes
コンパイル時間 2,050 ms
コンパイル使用メモリ 193,284 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-04-04 21:34:34
合計ジャッジ時間 6,407 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin >> N;
    vector<int> hold(N,-1);
    int holdb = -1;
    for(int i=0; i<N; i++){
        int a,b; cin >> a >> b;
        if(b == 2) holdb = i;
        else if(a == 1){
            if(b == 1) hold.at(i) = holdb,holdb = -1;
            hold.at(i+1) = i;
        }
        else{
            if(b == 1) hold.at(i) = holdb,holdb = -1;
            int pos = i;
            while(pos != -1){
                cout << pos+1 << "\n";
                pos = hold.at(pos);
            }
        }
    }
}
0