#include<iostream> #include <stdio.h> #include <string.h> using namespace std; int select(int a[], int n) { int max = 0; for (int i = 0; i < n; i++) { if (a[i] > a[max]) { max = i; } } return max+1; } int main() { int t; cin >> t; for (int j = 0; j < t; j++) { int s[100]; int n, m, a, b; cin >> n; cin >> m; for (int i = 0; i < n; i++) { scanf("%d %d", &a, &b); s[i] = a * 10 + b; } int lz; lz = select(s, n); cout << lz; s[lz - 1] = 0; for (int i = 1; i < m; i++) { lz = select(s, n); cout << " " << lz; s[lz - 1] = 0; } cout << endl; } return 0; } |
Double click to view unformatted code.