题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5349
#include<stdio.h> int main(){ int cnt; int max; int N; int ch; while(~scanf("%d",&N)){ cnt = ; while(N--){ scanf("%d",&ch); ){ scanf("%d",&ch); ) max = ch; cnt++; max = ch > max ? ch :max; continue; } &&cnt!=) cnt--; &&cnt!=) printf("%d\n",max); &&cnt==) printf("0\n"); } } }
#include<stdio.h> #include<cstring> #include<set> using namespace std; int main() { multiset<int>s; int T; int n, t; while(~scanf("%d",&T)){ while(T--){ scanf("%d",&n); switch(n){ : scanf("%d",&t); s.insert(t); break; : if(!s.empty()) s.erase(*s.begin()); break; : if(s.empty()) printf("0\n"); else printf("%d\n",*--s.end()); break; } } } }