样例过了但是只得了10分
#include<bits/stdc++.h>
using namespace std;
int n, x, y, k, m, t1[10001], t2[10001], xb1, xb2;
struct node{
int id, rs;
} b[10001], c[10001];
bool cmp(node e, node w){
if(e.rs==w.rs){
return e.id<w.id;
}
return e.rs > w.rs;
}
int main(){
cin >> n >> m >> x >> y >> k;
for (int i = 1; i <= k; i++) {
int sx,sy,ex,ey;
cin >> sx >> sy >> ex >> ey;
if (sy == ey) {
t1[min(sx,ex)]++;
}
if (sx == ex) {
t2[min(ey, sy)]++;
}
}
for (int i = 1; i <= 10000; i++) {
if (t1[i] == 1) {
xb1++;
b[xb1].id = i;
b[xb1].rs = t1[i];
}
if (t2[i] == 1) {
xb2++;
c[xb2].id = i;
c[xb2].rs = t2[i];
}
}
sort(b + 1, b + xb1 + 1, cmp);
sort(c + 1, c + xb2 + 1, cmp);
for (int i = 1; i <= x; i++) {
cout << b[i].id << " ";
}
cout << endl;
for (int i = 1; i <= y; i++) {
cout << c[i].id << " ";
}
return 0;
}