c++ <map>的使用
其实由于x和y不相等,可以桶排的……
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cmath>
#include<functional>
#include<algorithm>
#include<map>
using namespace std;
#define MAXN (1000+10)
#define MAXM (1000+10)
struct node
{
int x,y,w;
node():x(0),y(0),w(1){}
node(int _x,int _y,int _w):x(_x),y(_y),w(_w){}
friend bool operator<(const node a,const node b){ return (a.w!=b.w)?a.w<b.w:a.x+a.y>b.x+b.y; }
friend bool operator==(const node a,const node b){ return (a.x==b.x)&&(a.y==b.y);}
}a[MAXN];
int /*hash[MAXN+MAXM][2],*/n,m;
map<node,int> b;
int main()
{
cin>>n>>m;
for (int i=1;i<=n;i++)
{
scanf("%d%d",&a[i].x,&a[i].y);
a[i].w=1;
for (int j=1;j<i;j++)
{
if (a[i]==a[j]) a[i].w++;
}
}
sort(a+1,a+1+n);
for (int i=1;i<=m;i++)
{
int x,y;
scanf("%d%d",&x,&y);
b[node(x,y,0)]=1;
}
for (int i=n;i>=1;i--)
{
if (b.find(node(a[i].x,a[i].y,0))==b.end() )
{
cout<<a[i].x<<' '<<a[i].y<<endl;
return 0;
}
}
return 0;
}