拿set来练手了,其实简单的排序就行了
#include <iostream>
#include <set>
using namespace std;
int main(){
int x,y;
set<int> arx,ary;
set<int>::iterator i,j;
while(cin>>x>>y){
if(x==0 && y==0 && arx.size()==0) break;
if(x==0 && y==0){
i=arx.begin();
j=ary.begin();
cout<<*i<<" "<<*j<<" ";
i=arx.end(),i--;
j=ary.end(),j--;
cout<<*i<<" "<<*j<<endl;
arx.clear();
ary.clear();
continue;
}
arx.insert(x);
ary.insert(y);
}
return 0;
}