沈泽宇 • 1年前
using namespace std; int m,n,k,l,d,a,b,c,e; struct sa{
int cnt,tmp;
}x[2001]; struct sb{
int cnt1,tmp1;
}y[2001]; bool cmp(sa s1,sa s2){
return s1.cnt>s2.cnt;
} bool cmp1(sb s1,sb s2){
return s1.cnt1>s2.cnt1;
} bool cmp2(sa s1,sa s2){
return s1.tmp<s2.tmp;
} bool cmp3(sb s1,sb s2){
return s1.tmp1<s2.tmp1;
} int main(){
cin>>m>>n>>k>>l>>d;
for(int i=1;i<=d;i++){
cin>>a>>b>>c>>e;
if(a==c){
y[min(b,e)].cnt1++;
y[min(b,e)].tmp1=min(b,e);
}
else{
x[min(a,c)].cnt++;
x[min(a,c)].tmp=min(a,c);
}
}
sort(x+1,x+1+1000,cmp);
sort(y+1,y+1+1000,cmp1);
sort(x+1,x+1+k,cmp2);
sort(y+1,y+1+l,cmp3);
for(int i=1;i<=k;i++) cout<<x[i].tmp<<" ";
cout<<endl;
for(int i=1;i<=l;i++) cout<<y[i].tmp1<<" ";
return 0;
}
评论: