10分紧急求助!给关注
查看原帖
10分紧急求助!给关注
494699
卷王慢即快楼主2022/11/13 14:03
#include <iostream>
#include <algorithm>
using namespace std;
struct node
{
	int num;
	int pos;
}a[2001], b[2001];
int m, n, k, l, d, x1, y1, x2, y2;
inline bool cmp1(node x, node y)
{
	return x.num > y.num;
}
inline bool cmp2(node x, node y)
{
	return x.pos < y.pos;
}
int main()
{
	cin >> m >> n >> k >> l >> d;
	for(int i = 1; i <= d; i++)
	{
		cin >> x1 >> y1 >> x2 >> y2;
		if(x1 == x2)
		{
			int t = min(y1, y2);
			a[t].pos = t;
			a[t].num++;
		}
		else
		{
			int t = min(x1, x2);
			b[t].pos = t;
			b[t].num++;
		}
	}
	sort(a + 1, a + n + 1, cmp1);
	sort(a + 1, a + l + 1, cmp2);
	sort(b + 1, b + m + 1, cmp1);
	sort(b + 1, b + k + 1, cmp2);
	for(int i = 1; i <= k; i++)
		cout << a[i].pos << " ";
	cout << endl;
	for(int i = 1; i <= l; i++)
		cout << b[i].pos << " ";
	return 0;
}
2022/11/13 14:03
加载中...