2 solutions
-
0
#include<bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n>>m; vector<int >a; for(int i=0;i<n;i++){ int k; cin>>k; a.push_back(k); } while(m--){ int f; cin>>f; if(f==1){ int g,h; cin>>g>>h; if(g==0){ a.insert(a.begin(),h); }else { a.insert(a.begin()+g,h); } }else { int g; cin>>g; a.erase(a.begin()+g-1); } } for(int i=0;i<a.size();i++){ cout<<a[i]<<" "; } return 0; }
Information
- ID
- 838
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 2
- Tags
- # Submissions
- 33
- Accepted
- 23
- Uploaded By