#include<stdio.h> // int main( void ) { int t,i=0; scanf("%d",&t); while(i<t) { int n,m; scanf("%d%d",&n,&m); int j,m1,m2,a[100000],b[100000]; for(j=0;j<n;j++) { scanf("%d%d",&m1,&m2); a[j]=m1*10+m2; b[j]=j+1; } int t; int j1,j2; for(j1=0;j1<j-1;j1++) { for(j2=j1+1;j2<j;j2++) { if(a[j1]<a[j2]){t=a[j1];a[j1]=a[j2];a[j2]=t;t=b[j1];b[j1]=b[j2];b[j2]=t;} } } for(j=0;j<m;j++) { printf("%d ",b[j]); } i++; } } |
Double click to view unformatted code.