Submission #3417

# Submission time Handle Problem Language Result Execution time Memory
3417 2013-08-31T05:38:36 Z Qwaz Divide into triangle (kriii1_D) C++
1 / 1
0 ms 1096 KB
#include <cstdio>
#include <algorithm>

const int MAX=310;

struct pos {
	int x, y, num;

	bool operator < (const pos &t) const {
		if(y == t.y)
			return x < t.x;
		return y < t.y;
	}
};

int n;
pos data[MAX*3];

void input(){
	scanf("%d", &n);

	n *= 3;

	int i;
	for(i=0; i<n; i++){
		scanf("%d%d", &data[i].x, &data[i].y);

		data[i].num = i+1;
	}
}

void solve(){
	std::sort(data, data+n);

	pos p, q;

	int i;
	for(i=0; i<n; i++){
		if(i%3 == 0)
			p = data[i];
		else if(i%3 == 1)
			q = data[i];
		else
			printf("%d %d %d\n", p.num, q.num, data[i].num);
	}
}

int main(){
	input();

	solve();

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1096 KB Output is correct
2 Correct 0 ms 1096 KB Output is correct
3 Correct 0 ms 1096 KB Output is correct
4 Correct 0 ms 1096 KB Output is correct
5 Correct 0 ms 1096 KB Output is correct
6 Correct 0 ms 1096 KB Output is correct
7 Correct 0 ms 1096 KB Output is correct
8 Correct 0 ms 1096 KB Output is correct
9 Correct 0 ms 1096 KB Output is correct
10 Correct 0 ms 1096 KB Output is correct
11 Correct 0 ms 1096 KB Output is correct
12 Correct 0 ms 1096 KB Output is correct
13 Correct 0 ms 1096 KB Output is correct
14 Correct 0 ms 1096 KB Output is correct
15 Correct 0 ms 1096 KB Output is correct
16 Correct 0 ms 1096 KB Output is correct
17 Correct 0 ms 1096 KB Output is correct
18 Correct 0 ms 1096 KB Output is correct
19 Correct 0 ms 1096 KB Output is correct
20 Correct 0 ms 1096 KB Output is correct