QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#516573 | #7680. Subway | pandapythoner | WA | 0ms | 3620kb | C++23 | 1.5kb | 2024-08-12 18:58:30 | 2024-08-12 18:58:30 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i += 1)
#define rng(i, start, end, step) for(int i = start; i < end; i += step)
#define len(a) ((int)(a).size())
mt19937 rnd(234);
int32_t main() {
if (1) {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int n;
cin >> n;
vector<array<int, 3>> a(n);
rep(i, n) rep(j, 3) cin >> a[i][j];
int mx = 0;
rep(i, n) mx = max(mx, a[i][2]);
a.push_back(array<int, 3>{-1001, -1001, mx});
a.push_back(array<int, 3>{1001, 1001, mx});
n += 2;
sort(a.begin(), a.end(), [&](array<int, 3> a, array<int, 3> b) {
return a[0] * 2 + 10001 * a[1] < b[0] * 2 + 10001 * b[1];
});
vector<array<int, 2>> d(n - 1);
rep(i, n - 1) d[i] = { a[i][0] - 5000, a[i][1] + 1 };
vector<vector<array<int, 2>>> lines(mx);
rep(itr, mx) {
rep(i, n) {
if (a[i][2] > 0) {
lines[itr].push_back({ a[i][0], a[i][1] });
a[i][2] -= 1;
}
if (i == n - 1) break;
lines[itr].push_back({ d[i][0], d[i][1] });
d[i][0] -= 10001;
d[i][1] += 2;
}
}
cout << mx << "\n";
for (auto line : lines) {
cout << len(line);
for (auto [x, y] : line) {
cout << " " << x << " " << y;
}
cout << "\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3620kb
input:
3 1 2 1 2 1 2 3 3 2
output:
2 9 -1001 -1001 -6001 -1000 2 1 -4998 2 1 2 -4999 3 3 3 -4997 4 1001 1001 8 -1001 -1001 -16002 -998 2 1 -14999 4 -15000 5 3 3 -14998 6 1001 1001
result:
wrong answer Polyline 2 intersects with previous polylines.