Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <queue>
- #include <stack>
- #include <string>
- using namespace std;
- int main(){
- int n;
- stack<int> tshirts;
- queue<string> participants;
- cin >> n;
- int o;
- string ns;
- int k, t;
- while(n--){
- cin >> o;
- switch(o){
- case 1:
- cin >> k;
- for(int i = 0; i < k; i++){
- cin >> ns;
- participants.push(ns);
- }
- break;
- case 2:
- cin >> k;
- for(int i = 0; i < k; i++){
- cin >> t;
- tshirts.push(t);
- }
- break;
- case 3:
- cin >> k;
- for(int i = 0; i < k; i++){
- cout << participants.front() << " " << tshirts.top() << endl;
- participants.pop();
- tshirts.pop();
- }
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement