Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- int compare(pair<int, int> p1, pair<int, int> p2)
- {
- return (p1.first > p2.first);
- }
- int main()
- {
- int n, m, k;
- cin >> n >> m >> k;
- vector<pair<int, int>> input(n);
- for (int i = 0; i < n; i++) {
- cin >> input[i].first;
- input[i].second = i + 1;
- }
- sort(input.begin(), input.end(), compare);
- vector<vector<int>> output(k, vector<int>(0));
- int i = 0;
- while (input.size() > 0) {
- int element = input.back().second;
- input.pop_back();
- output[i].push_back(element);
- i += 1;
- if (i == k) i = 0;
- }
- for (int i = 0; i < k; i++) {
- cout << output[i].size() << " ";
- for (int j = 0; j < output[i].size(); j++) {
- cout << output[i][j] << " ";
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement