Submission #3900

# Submission time Handle Problem Language Result Execution time Memory
3900 2013-08-31T09:14:02 Z shinhj88 Divide into triangle (kriii1_D) C++
0 / 1
0 ms 1088 KB
#include<stdio.h>
#include<stdlib.h>
typedef struct M_str{
	int x, y, idx;
}M_str;
M_str m_str[900];
int n;
int m_cmp(const void * a, const void * b){
	int x1, x2, y1, y2;
	x1=*(int *)b;
	x2=*(int *)a;
	y1=*((int *)b+1);
	y2=*((int *)a+1);
	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", &m_str[i].x, &m_str[i].y);
		m_str[i].idx=i+1;
	}
	qsort(m_str, 3*n, 12, m_cmp);
	while(1);
	for(i=0;i<n;++i){
		for(j=0;j<2;++j){
			printf("%d ", m_str[i*3+j].idx);
		}
		printf("%d\n", m_str[i*3+j].idx);
	}

}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1088 KB open (syscall #2) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -