# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
4318 | kipa00 | Divide into triangle (kriii1_D) | C++98 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <algorithm>
using namespace std;
class Fence {
public:
int x, y, n;
bool operator<(Fence f) {
bool res = x < f.x;
if (x == f.x) {
return y < f.y;
}
return res;
}
};
int main() {
Fence arr[900];
int N, i;
scanf("%d", &N);
N *= 3;
for (i=0; i<N; ++i) {
Fence ff;
int x, y;
scanf("%d %d", &x, &y);
ff.x = x; ff.y = y;
ff.n = i + 1;
arr[i] = ff;
}
sort(arr, arr+N);
for (i=0; i<N;) {
printf("%d ", arr[i].n);
if (!((++i) % 3)) {
printf("\n");
}
}
return 0;
}