求调10分P1056
  • 板块灌水区
  • 楼主lxy0816
  • 当前回复0
  • 已保存回复0
  • 发布时间2025/1/13 20:19
  • 上次更新2025/1/14 09:54:06
查看原帖
求调10分P1056
1180620
lxy0816楼主2025/1/13 20:19

样例过了但是只得了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;
}
2025/1/13 20:19
加载中...