Submission #3871

# Submission time Handle Problem Language Result Execution time Memory
3871 2013-08-31T08:59:53 Z shinhj88 Divide into triangle (kriii1_D) C++
0 / 1
200 ms 1088 KB
#include<stdio.h>
#include<stdlib.h>
typedef struct Str{
	int x, y, idx;
}Str;
Str str[900];
int n;
int cmp(const void * a, const void * b){
	int x1, x2, y1, y2;
	x1=((Str *)b)->x;
	x2=((Str *)a)->x;
	y1=((Str *)b)->y;
	y2=((Str *)a)->y;
	if(x1==x2)
		return y1-y2;
	return x1-x2;
}
int main(){
	int i, j;
	scanf("%d", &n);
	for(i=0;i<n*3;++i){
		scanf("%d%d", &str[i].x, &str[i].y);
		str[i].idx=i+1;
	}
	while(1);
	qsort(str, 3*n, sizeof(Str), cmp);
	for(i=0;i<n;++i){
		for(j=0;j<2;++j){
			printf("%d ", str[i*3+j].idx);
		}
		printf("%d\n", str[i*3+j].idx);
	}

}
# Verdict Execution time Memory Grader output
1 Execution timed out 200 ms 1088 KB Program timed out
2 Halted 0 ms 0 KB -