답안 #18614

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
18614 2016-02-12T11:01:06 Z hongjun7 Divide into triangle (kriii1_D) C++14
1 / 1
1 ms 1112 KB
#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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1112 KB Output is correct
2 Correct 0 ms 1112 KB Output is correct
3 Correct 0 ms 1112 KB Output is correct
4 Correct 0 ms 1112 KB Output is correct
5 Correct 0 ms 1112 KB Output is correct
6 Correct 0 ms 1112 KB Output is correct
7 Correct 0 ms 1112 KB Output is correct
8 Correct 0 ms 1112 KB Output is correct
9 Correct 1 ms 1112 KB Output is correct
10 Correct 0 ms 1112 KB Output is correct
11 Correct 0 ms 1112 KB Output is correct
12 Correct 0 ms 1112 KB Output is correct
13 Correct 0 ms 1112 KB Output is correct
14 Correct 0 ms 1112 KB Output is correct
15 Correct 0 ms 1112 KB Output is correct
16 Correct 0 ms 1112 KB Output is correct
17 Correct 0 ms 1112 KB Output is correct
18 Correct 0 ms 1112 KB Output is correct
19 Correct 0 ms 1112 KB Output is correct
20 Correct 0 ms 1112 KB Output is correct