QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#136605 | #237. Triangle Partition | BoulevardDust# | 100 ✓ | 5ms | 3684kb | C++17 | 544b | 2023-08-09 09:17:28 | 2023-08-09 09:17:29 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int T, n;
struct P {
int x, y, id;
int operator<(const P &p) const {
return y < p.y || (y == p.y && x < p.x);
}
}a[5005];
int main() {
scanf("%d", &T);
while(T--) {
scanf("%d", &n);
for(int i = 1; i <= n * 3; ++i) {
scanf("%d%d", &a[i].x, &a[i].y);
a[i].id = i;
}
sort(a + 1, a + n * 3 + 1);
for(int i = 1; i <= n * 3; i += 3) {
printf("%d %d %d\n", a[i].id, a[i + 1].id, a[i + 2].id);
}
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 5ms
memory: 3684kb
input:
190 10 -7215 2904 -5179 1663 -542 1091 -5687 7868 7838 -1048 -2944 4346 -2780 3959 -9402 1099 -8548 -7238 -3821 -2917 2713 295 -856 -8661 7651 3945 -8216 -543 5798 5024 8583 -3384 -1208 5955 3068 -385 340 2968 6559 -272 4537 5075 5126 4343 639 8281 1700 2572 819 9317 -9854 -1316 -3421 -1137 9368 718...
output:
12 9 30 16 10 26 27 5 14 18 20 11 28 3 8 2 29 24 1 19 13 7 22 6 15 21 17 4 23 25 6 26 22 4 25 21 13 23 9 29 8 20 3 2 30 15 5 11 27 12 16 7 14 17 10 28 24 19 18 1 7 10 3 21 11 19 6 20 16 9 30 5 26 18 23 4 24 22 14 1 28 29 13 17 8 27 25 15 2 12 12 25 18 27 30 24 21 1 3 14 10 7 26 17 13 5 28 4 9 6 20 2...
result:
ok AC