标签:
Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 2541 Accepted Submission(s): 694
1 /************************************************************************* 2 > File Name: code/multi/#5/1007.cpp 3 > Author: 111qqz 4 > Email: rkz2013@126.com 5 > Created Time: 2015年08月04日 星期二 12时39分42秒 6 ************************************************************************/ 7 8 #include<iostream> 9 #include<iomanip> 10 #include<cstdio> 11 #include<algorithm> 12 #include<cmath> 13 #include<cstring> 14 #include<string> 15 #include<map> 16 #include<set> 17 #include<queue> 18 #include<vector> 19 #include<stack> 20 #define y0 abc111qqz 21 #define y1 hust111qqz 22 #define yn hez111qqz 23 #define j1 cute111qqz 24 #define tm crazy111qqz 25 #define lr dying111qqz 26 using namespace std; 27 #define REP(i, n) for (int i=0;i<int(n);++i) 28 typedef long long LL; 29 typedef unsigned long long ULL; 30 const int inf = 0x7fffffff; 31 const int N=1E6+7; 32 multiset<int>se; 33 multiset<int>::iterator it; 34 int main() 35 { 36 int n; 37 int cmd; 38 int x; 39 scanf("%d",&n); 40 for ( int i = 0 ; i < n; i++) 41 { 42 scanf("%d",&cmd); 43 if (cmd==1) 44 { 45 scanf("%d",&x); 46 se.insert(x); 47 } 48 if (cmd==2&&!se.empty()) 49 { 50 se.erase(se.begin()); 51 } 52 if (cmd==3) 53 { 54 if (se.empty()) 55 { 56 printf("0\n"); 57 } 58 else 59 { 60 it = se.end(); 61 it--; 62 printf("%d\n",*it); 63 } 64 } 65 } 66 return 0; 67 }
2015 多校 #5 1007 MZL's simple problem
标签:
原文地址:http://www.cnblogs.com/111qqz/p/4711615.html