Submission #18614

#TimeUsernameProblemLanguageResultExecution timeMemory
18614hongjun7Divide into triangle (kriii1_D)C++14
1 / 1
1 ms1112 KiB
#include <stdio.h>
#include <algorithm>
using namespace std;
const double inf = 1e9;
int n;
struct P {
	double x, y, g;
	int idx;
} p[999];
inline bool cmp(P a, P b) {
	return a.g < b.g;
}
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= 3 * n; i++) {
		scanf("%lf%lf", &p[i].x, &p[i].y);
		p[i].g = (p[i].y - inf) / (p[i].x - 2 * inf);
		p[i].idx = i;
	}
	sort(p + 1, p + 3 * n + 1, cmp);
	for (int i = 1; i <= 3 * n; i += 3) printf("%d %d %d\n", p[i].idx, p[i + 1].idx, p[i + 2].idx);
}
#Verdict Execution timeMemoryGrader output
Fetching results...