Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void solve(const int n, const int m, const int k) {
- priority_queue<pair<int, int> > q;
- for (int i = 0; i < n; ++i) {
- q.push(make_pair(0, i));
- }
- for (int i = 0; i < m; ++i) {
- auto a = q.top(); q.pop();
- auto b = q.top(); q.pop();
- cout << a.second + 1 << " " << b.second + 1 << endl;
- a.first--, b.first--;
- q.push(a); q.push(b);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement