、、、
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
const int N = 1e5+10;
int e[N],ne[N],head,idx;
void init(){
head=-1;
idx=0;
}
void in_to_head(int x){
e[idx]=x;
ne[idx]=head;
head=idx;
idx+=1;
}
void add(int k,int x){
e[idx]=x;
ne[idx]=ne[k];
ne[k]=idx;
idx+=1;
}
void remove(int k)
{
ne[k]=ne[ne[k]];
}
int main(){
int m;
cin>>m;
string str;
init();
while(m–){
cin>>str;
//cout<[HTML_REMOVED]>x;
//cout<[HTML_REMOVED]>k;
if(k==0)head=ne[head];
else remove(k-1);
}else if(str[0]==’I’){
int k,x;
cin>>k>>x;
add(k-1,x);
//cout<<idx<<’ ‘;
}
}
//cout<<head;
for(int i=head;i!=-1;i=ne[i]){
cout<<e[i]<<’ ‘;
}
return 0;
}
、、、