Submission #66976522


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
const int N=3e5+10;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
map<int,int> mp;
int n,m,k;
int a[N],b[N];
void slove(){
    cin>>n>>m;
    vector<vector<int>> q(N,vector<int>());
    vector<string> p;
    vector<int> ans;
    int x;
    int coun=0;
    for(int i=1;i<=m;i++){
        cin>>x;
        if(x==1){
            int l;cin>>l;
            for(auto t:q[l]){
                q[l].pop_back();
            }
            for(auto t:ans){
                q[l].push_back(t);
            }
        }
        else if(x==2){
            int l;
            string ss;
            cin>>l>>ss;
            p.push_back(ss);
            coun++;
            q[l].push_back(coun);
        }
        else{
            int l;cin>>l;
            for(auto t:ans) ans.pop_back();
            for(auto t:q[l]){
                ans.push_back(t);
            }
        }
    }
    string s="";
    for(auto t:ans){
        s+=p[t-1];
    }
    cout<<s<<endl;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
    int T=1;
    // cin>>T;
    while(T--){
        slove();
    }
}

Submission Info

Submission Time
Task D - Conflict 2
User Maikan
Language C++ 20 (gcc 12.2)
Score 0
Code Size 1211 Byte
Status TLE
Exec Time 2367 ms
Memory 2826720 KiB

Compile Error

Main.cpp: In function ‘void slove()’:
Main.cpp:21:22: warning: unused variable ‘t’ [-Wunused-variable]
   21 |             for(auto t:q[l]){
      |                      ^
Main.cpp:38:22: warning: unused variable ‘t’ [-Wunused-variable]
   38 |             for(auto t:ans) ans.pop_back();
      |                      ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 425
Status
AC × 3
AC × 36
TLE × 13
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 02_random2_10.txt, 02_random2_11.txt, 02_random2_12.txt, 02_random2_13.txt, 02_random2_14.txt, 02_random2_15.txt, 03_random3_00.txt, 03_random3_01.txt, 03_random3_02.txt, 03_random3_03.txt, 04_random4_00.txt, 04_random4_01.txt, 05_random5_00.txt, 05_random5_01.txt, 06_handmade_00.txt, 06_handmade_01.txt, 06_handmade_02.txt, 06_handmade_03.txt, 06_handmade_04.txt, 06_handmade_05.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 4 ms 10260 KiB
00_sample_01.txt AC 4 ms 10164 KiB
00_sample_02.txt AC 5 ms 10260 KiB
01_random_00.txt AC 7 ms 10800 KiB
01_random_01.txt AC 30 ms 12940 KiB
01_random_02.txt AC 33 ms 13236 KiB
01_random_03.txt AC 5 ms 10428 KiB
01_random_04.txt AC 39 ms 16496 KiB
01_random_05.txt AC 10 ms 11496 KiB
01_random_06.txt AC 7 ms 11092 KiB
01_random_07.txt AC 9 ms 11116 KiB
01_random_08.txt AC 30 ms 12004 KiB
01_random_09.txt AC 30 ms 12920 KiB
01_random_10.txt AC 24 ms 12620 KiB
01_random_11.txt AC 11 ms 10948 KiB
01_random_12.txt AC 27 ms 14096 KiB
01_random_13.txt AC 24 ms 13076 KiB
01_random_14.txt AC 30 ms 12784 KiB
01_random_15.txt AC 22 ms 12716 KiB
02_random2_00.txt AC 52 ms 15932 KiB
02_random2_01.txt AC 51 ms 15800 KiB
02_random2_02.txt AC 52 ms 15836 KiB
02_random2_03.txt AC 55 ms 15760 KiB
02_random2_04.txt AC 53 ms 19536 KiB
02_random2_05.txt TLE 2362 ms 2826720 KiB
02_random2_06.txt TLE 2367 ms 2825028 KiB
02_random2_07.txt AC 42 ms 13296 KiB
02_random2_08.txt AC 48 ms 21292 KiB
02_random2_09.txt TLE 2352 ms 2650976 KiB
02_random2_10.txt TLE 2351 ms 2617016 KiB
02_random2_11.txt AC 34 ms 11796 KiB
02_random2_12.txt AC 41 ms 23488 KiB
02_random2_13.txt TLE 2340 ms 2397504 KiB
02_random2_14.txt TLE 2340 ms 2413936 KiB
02_random2_15.txt AC 26 ms 10128 KiB
03_random3_00.txt TLE 2339 ms 2399512 KiB
03_random3_01.txt TLE 2339 ms 2411544 KiB
03_random3_02.txt TLE 2340 ms 2411812 KiB
03_random3_03.txt TLE 2210 ms 13268 KiB
04_random4_00.txt TLE 2339 ms 2394488 KiB
04_random4_01.txt TLE 2340 ms 2408856 KiB
05_random5_00.txt AC 35 ms 22312 KiB
05_random5_01.txt AC 39 ms 22476 KiB
06_handmade_00.txt AC 5 ms 10164 KiB
06_handmade_01.txt AC 7 ms 12196 KiB
06_handmade_02.txt AC 34 ms 10036 KiB
06_handmade_03.txt AC 63 ms 22680 KiB
06_handmade_04.txt AC 35 ms 10120 KiB
06_handmade_05.txt TLE 2208 ms 13044 KiB