Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- int n;
- scanf("%d", &n);
- stack<int> stk[2];
- for(int i = 1; i <= n; ++i){
- char cmd;
- scanf(" %c%*c%*c", &cmd);
- if(cmd == 'e'){
- int x;
- scanf("%d", &x);
- stk[0].push(x);
- cout << "push 1\n";
- } else if(cmd == 'd'){
- if(stk[1].empty()){
- while(!stk[0].empty()){
- stk[1].push(stk[0].top());
- stk[0].pop();
- cout << "move 1 2\n";
- }
- }
- if(!stk[1].empty()){
- cout << "pop 2\n";
- cout << stk[1].top() << '\n';
- stk[1].pop();
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement