#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; while(n--){ int x,y,j,a[1000][2] = { }; cin>>x>>y; for(int i = 0;i<x;i++)cin>>a[i][0]>>a[i][1]; for( int i = 0;i < y;i++ ){ // 篮子的数量 循环次数 int tmp = 0; for( j = 0;j < x;j++){ if( a[tmp][0] < a[j][0] ) tmp = j; else if( a[tmp][0] == a[j][0] && a[tmp][1] < a[j][1] ) tmp = j; } cout<<tmp+1; if(i != y-1)cout<<" "; a[tmp][0] = -1; } cout<<endl; } return 0; } |
Double click to view unformatted code.