SHOW:
|
|
- or go back to the newest paste.
| 1 | - | the le greed wifeu (Gothitelle) (M) @ Kee Berry |
| 1 | + | #include<stdio.h> |
| 2 | - | Ability: Shadow Tag |
| 2 | + | #include<string.h> |
| 3 | - | EVs: 252 HP / 252 Def / 4 SpD |
| 3 | + | #include<math.h> |
| 4 | - | Bold Nature |
| 4 | + | #include<ctype.h> |
| 5 | - | - Recycle |
| 5 | + | #include<stdlib.h> |
| 6 | - | - Calm Mind |
| 6 | + | #include<cstdio> |
| 7 | - | - Rest |
| 7 | + | #include<cstring> |
| 8 | - | - Psyshock/Any Attack |
| 8 | + | #include<string> |
| 9 | #include<cmath> | |
| 10 | #include<iostream> | |
| 11 | #include<cctype> | |
| 12 | #include<map> | |
| 13 | #include<stack> | |
| 14 | #include<cstdlib> | |
| 15 | #include <queue> | |
| 16 | #include <vector> | |
| 17 | #include<algorithm> | |
| 18 | ||
| 19 | ||
| 20 | using namespace std; | |
| 21 | typedef long int LD; | |
| 22 | typedef long long int LLD; | |
| 23 | typedef float F; | |
| 24 | typedef double LF; | |
| 25 | typedef unsigned int U; | |
| 26 | typedef unsigned long int LU; | |
| 27 | typedef unsigned long long int LLU; | |
| 28 | typedef char C; | |
| 29 | ||
| 30 | #define sf scanf | |
| 31 | #define pf printf | |
| 32 | #define PI acos(-1.0) | |
| 33 | #define sq(x) (x)*(x) | |
| 34 | #define MAX(x,y) (x>y)?x:y | |
| 35 | #define MIN(x,y) (x<y)?x:y | |
| 36 | #define MAX3(x,y,z) (x>y)?((x>z)?x:z):((y>z)?((y>x)?y:x):z) | |
| 37 | #define MIN3(x,y,z) (x<y)?((x<z)?x:z):((y<z)?((y<x)?y:x):z) | |
| 38 | #define nn printf("\n")
| |
| 39 | //#define sz 1005 | |
| 40 | ||
| 41 | /****** start your code *******/ | |
| 42 | ||
| 43 | int main() | |
| 44 | {
| |
| 45 | int n,a,b,i,nt,im,q,p,s,coun; | |
| 46 | while(sf("%d",&n)!=EOF)
| |
| 47 | {
| |
| 48 | queue<int>qu; | |
| 49 | priority_queue<int>pqu; | |
| 50 | stack<int>stk; | |
| 51 | nt=im=q=p=s=coun=0; | |
| 52 | for(i=0; i<n; i++) | |
| 53 | {
| |
| 54 | sf("%d%d",&a,&b);
| |
| 55 | switch(a) | |
| 56 | {
| |
| 57 | case 1: | |
| 58 | {
| |
| 59 | qu.push(b); | |
| 60 | pqu.push(b); | |
| 61 | stk.push(b); | |
| 62 | } | |
| 63 | break; | |
| 64 | case 2: | |
| 65 | {
| |
| 66 | int x,y,z; | |
| 67 | coun++; | |
| 68 | x=qu.front(); | |
| 69 | qu.pop(); | |
| 70 | y=pqu.top(); | |
| 71 | pqu.pop(); | |
| 72 | z=stk.top(); | |
| 73 | stk.pop(); | |
| 74 | if((x==b && y==b)||(x==b && z==b)|| (z==b && y==b)) | |
| 75 | nt++; | |
| 76 | if(x==b) | |
| 77 | q++; | |
| 78 | if(y==b) | |
| 79 | p++; | |
| 80 | if(z==b) | |
| 81 | s++; | |
| 82 | if(x!=b && y!=b && z!=b) | |
| 83 | im++; | |
| 84 | } | |
| 85 | //break; | |
| 86 | } | |
| 87 | } | |
| 88 | if(nt==coun) | |
| 89 | pf("not sure\n");
| |
| 90 | else if(q==coun) | |
| 91 | pf("queue\n");
| |
| 92 | else if(p==coun) | |
| 93 | pf("priority queue\n");
| |
| 94 | else if(s==coun) | |
| 95 | pf("stack\n");
| |
| 96 | else if(im==coun) | |
| 97 | pf("impossible\n");
| |
| 98 | else | |
| 99 | pf("impossible\n");
| |
| 100 | ||
| 101 | } | |
| 102 | return 0; | |
| 103 | } |