Submission #4210

#TimeUsernameProblemLanguageResultExecution timeMemory
4210zorrapowerDivide into triangle (kriii1_D)C++98
1 / 1
0 ms1088 KiB
#include <stdio.h> typedef struct pointType{ int x; int y; int index; int sumXY; }pointType; int main(void){ int N; int currentIndex=0; pointType point[900]={0,}; scanf("%d", &N); for(int i=0; i<3*N; i++){ scanf("%d %d", &point[i].x, &point[i].y); point[i].index=++currentIndex; point[i].sumXY=point[i].x + point[i].y; } for(int i=0; i<3*N; i++){ for(int j=i; j<3*N; j++){ if(point[i].sumXY > point[j].sumXY){ pointType tmp; tmp=point[i]; point[i]=point[j]; point[j]=tmp; } } } for(int i=0; i<3*N; i++){ printf("%d ", point[i].index); if(i%3==2) printf("\n"); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...