You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
|
using namespace std;
|
|
|
|
|
const int N = 1010;
|
|
|
|
|
|
|
|
|
|
int m, n, k, l, d; // m行n列,k条横向的通道,l条纵向的通道,d对同学交头接耳
|
|
|
|
|
int y[N], x[N]; // 横纵坐标数组
|
|
|
|
|
int b1[N], b2[N]; // 桶排要用的数组
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
cin >> m >> n >> k >> l >> d;
|
|
|
|
|
|
|
|
|
|
while (d--) {
|
|
|
|
|
int x1, y1, x2, y2;
|
|
|
|
|
cin >> x1 >> y1 >> x2 >> y2;
|
|
|
|
|
if (x1 == x2) // 横坐标相等,则记录到个数数组中
|
|
|
|
|
y[min(y1, y2)]++; // 表示隔开这两排的价值
|
|
|
|
|
else
|
|
|
|
|
x[min(x1, x2)]++; // 记得取min,即过道与前一个坐标保持一致
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i <= k; i++) { // 循环k次
|
|
|
|
|
int mx = 0; // 临时最大值
|
|
|
|
|
int p; // 临时最大值位置
|
|
|
|
|
for (int j = 1; j <= m; j++) {
|
|
|
|
|
if (x[j] > mx) {
|
|
|
|
|
mx = x[j];
|
|
|
|
|
p = j;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
x[p] = 0; // 求出max之后一定要记得清零!!否则无论排多少次都是一个答案
|
|
|
|
|
b1[p]++; // p这行是需要加入过道的
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i <= l; i++) {
|
|
|
|
|
int mx = 0;
|
|
|
|
|
int p;
|
|
|
|
|
for (int j = 1; j <= n; j++) {
|
|
|
|
|
if (y[j] > mx) {
|
|
|
|
|
mx = y[j];
|
|
|
|
|
p = j;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
y[p] = 0; // 同上
|
|
|
|
|
b2[p]++; // p这列是需要加入过道的
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 输出答案
|
|
|
|
|
for (int i = 1; i <= m; i++)
|
|
|
|
|
if (b1[i]) printf("%d ", i); // 表示需要隔开这行
|
|
|
|
|
|
|
|
|
|
puts("");
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i <= n; i++)
|
|
|
|
|
if (b2[i]) printf("%d ", i);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|