#include<stdio.h>
#define swap(aa,bb) {int cc;cc=aa;aa=bb;bb=cc;}
int a[900][3]={0};
int main(){
int n;
int i,j;
scanf("%d",&n);
for(i=1;i<=3*n;i++){
scanf("%d %d",&a[i][0],&a[i][1]);
a[i][2]=i;
}
for(i=1;i<=3*n;i++){
for(j=i+1;j<=3*n;j++){
if(a[i][0]>a[j][0]){
swap(a[i][0],a[j][0]);
swap(a[i][1],a[j][1]);
swap(a[i][2],a[j][2]);
}else if(a[i][0]==a[j][0]){
if(a[i][1]>a[j][1]){
swap(a[i][0],a[j][0]);
swap(a[i][1],a[j][1]);
swap(a[i][2],a[j][2]);
}
}
}
}
/*
for(i=1;i<=3*n;i++){
for(j=0;j<3;j++){
printf("%d ",a[i][j]);
}
printf("\n");
}
*/
for(i=0;i<n;i++){
for(j=0;j<3;j++){
printf("%d ",a[i*3+j+1][2]);
}
printf("\n");
}
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 |