Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ll n, m;
- cin >> n >> m;
- vector<int> v1(n);
- vector<int> v2(n);
- for (int i = 0; i < n; i++)
- {
- cin >> v1[i];
- v2[i] = v1[i];
- }
- sort(v1.begin(), v1.end(), greater<int>());
- cout << v1[m - 1] << nl;
- auto it1 = v1.begin() + m;
- auto it2 = v1.end();
- v1.erase(it1, it2);
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < v1.size(); j++)
- {
- if (v2[i] == v1[j])
- {
- cout << i + 1 << " ";
- auto it3 = v1.begin() + j;
- v1.erase(it3);
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement