题目 这题不难,但是如果用priority_queue() 做的话就异常的简单。还是分享一下
#define LOCAL
#include<stdio.h>
#include<queue>
#include<iostream>
using namespace std;
int main(){
#ifdef LOCAL
freopen("C:/Users/Administrator/Desktop/input.txt","r", stdin);
#endif
priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > cell;
int n, a, b;
while(scanf("%d", &n)!=EOF){
while(n--){
scanf("%d%d",&a, &b);
pair<int, int> c(a, b);
cell.push(c);
}
printf("%d %d\n", cell.top().first, cell.top().second);
while(!cell.empty()) cell.pop();
}
return 0;
}