#include<iostream> #include <stdio.h> #include <string.h> using namespace std; int main() { int t; scanf("%d", &t); for (int i = 0; i < t; i++) { int n, m; int a[1000], b[1000]; scanf("%d %d", &n, &m); for (int j = 0; j < n; j++) { scanf("%d %d", &a[j], &b[j]); } while (m > 0) { int max = 0; for (int j = 0; j < n; j++) { if (a[j] > a[max]) { max = j; } else if (a[j] == a[max]) { if (b[j] > b[max]) { max = j; } } } if (m == 1) printf("%d", max+1); else printf("%d ", max+1); m--; a[max] = 0; b[max] = 0; } printf("\n"); } return 0; /* Main.cc: In function 'int main()': Main.cc:45:10: error: expected '}' at end of input return 0; ^ */ |
Double click to view unformatted code.