80pts,最后两个点TLE
查看原帖
80pts,最后两个点TLE
1124230
Allen123456hello楼主2024/1/12 18:22

使用STL

#include <bits/stdc++.h>
#define yuansheng int main(){
#define qidong return 0;}
using namespace std;
list<int> arr(1,1);
yuansheng
    int T,x,y;char op;
    scanf("%d",&T);
    list<int>::iterator it;
    ++T;while (--T){
        scanf("%hhd",&op);
        it=arr.begin();
        if (op==1){
            scanf("%d%d",&x,&y);
            while (*it!=x){++it;}
            arr.insert(++it,y);
        }else if (op==2){
            scanf("%d",&x);
            while (*it!=x){++it;}++it;
            printf("%d\n",(it==arr.end())?0:*it);
        }else{
            scanf("%d",&x);
            while (*it!=x){++it;}
            arr.erase(++it);
        }
    }
    return 0;
qidong
2024/1/12 18:22
加载中...