# include # include # include # include # include # include using namespace std; int main() { mapq; map::iterator p; int n,name,num; while(~scanf("%d",&n),n) { if(n==1) { scanf("%d%d",&name,&num); q.insert(pair(num,name));///自動按num從小到大 } else if(n==3)///按num小的輸出 { if(q.size()) { p=q.begin();///取第一個 printf("%d\n",p->second); q.erase(p);///刪除 } else printf("0\n"); } else { if(q.size()) { printf("%d\n",q.rbegin()->second);///取最後一個 q.erase(q.find(q.rbegin()->first)); } else printf("0\n"); } } return 0; }
[cpp] /* * 程序的版
一. 舉例 比如,現在中圖和日本在關於釣魚島問題上存在
POj 1753--Flip Game--位運算+BFS
C++編程語言應用廣泛,其中的關鍵字應用尤其值得我們去深入
HDU 1180 詭異的樓梯 ʌ
Video Surveillance Tim