Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
108531 杨博煊 排座椅 C++ 通过 100 1 MS 260 KB 1022 2023-11-03 13:57:23

Tests(10/10):


#include <iostream> #include <algorithm> //D using namespace std; int m, n, p, q, d; int x1, y1, x2, y2; struct node { int num, pos; }; node x[1005], y[1005]; bool cmp(node a, node b) { return a.num > b.num; } bool cmp_(node a, node b) { return a.pos < b.pos; } int main() { cin >> m >> n >> p >> q >> d; for (int i = 1; i <= d; i++) { cin >> x1 >> y1 >> x2 >> y2; if (x1 != x2) { x[min(x1, x2)].num++; x[min(x1, x2)].pos = min(x1, x2); } else { y[min(y1, y2)].num++; y[min(y1, y2)].pos = min(y1, y2); } } sort(x + 1, x + n + 1, cmp); sort(y + 1, y + m + 1, cmp); sort(x + 1, x + p + 1, cmp_); sort(y + 1, y + q + 1, cmp_); for (int i = 1; i <= p; i++) { cout << x[i].pos << " "; } cout << endl; for (int i = 1; i <= q; i++) { cout << y[i].pos << " "; } return 0; }


测评信息: