Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <queue>
- #include <stdio.h>
- int main() {
- freopen("input.txt", "rt", stdin);
- freopen("output.txt", "wt", stdout);
- std::priority_queue<int, std::vector<int>, std::greater<int>> q;
- int n, m, v;
- scanf("%d %d", &n, &m);
- while (n--)
- scanf("%d", &v), q.push(v);
- while (m--)
- v = q.top(), q.pop(), q.push(v+1);
- printf("%d", q.top());
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement