Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_DEPRECATE
- #include <iostream>
- #include <vector>
- #include <string>
- #include <map>
- #include <set>
- #include <algorithm>
- #define li long long
- using namespace std;
- int main() {
- int n;
- cin >> n;
- multiset<int> a;
- for (int i = 0; i < n; i++) {
- int c;
- cin >> c;
- if (c == 0) {
- cout << *a.begin() << endl;
- a.erase(a.begin());
- }
- else {
- a.insert(c);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement