#include <iostream> int whichismax(int v[],int i) { int temp = 0; for (int j = 0; j < i; j++) { if (v[j] > v[temp]) { temp = j; } } return temp; } int main() { int t; int a[10000][1], b[10000]; int v[10000]; std::cin >> t; while (t--) { int m, n; std::cin >> n >> m; for (int i = 0; i < n; i++) { std::cin >> a[i][0] >> a[i][1]; } for (int i = 0 ; i < n; i++) { v[i] = a[i][0] + 100000 + a[i][1]; } for (int i = 0; i < m; i++) { int t = whichismax(v, n) + 1; if (i == m - 1) { std::cout << t; } else { std::cout << t << " "; } v[whichismax(v, n)] = -1; } std::cout << "\n"; } return 0; } |
Double click to view unformatted code.