Submission #1118136

# Submission time Handle Problem Language Result Execution time Memory
1118136 2024-11-25T03:26:25 Z overwatch9 Baloni (COCI15_baloni) C++17
100 / 100
292 ms 3916 KB
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    multiset <int> s;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (s.find(x+1) != s.end()) {
            s.erase(s.find(x+1));
            s.insert(x);
        } else {
            s.insert(x);
        }
    }
    cout << (int)s.size() << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 2 ms 336 KB Output is correct
4 Correct 3 ms 336 KB Output is correct
5 Correct 249 ms 3916 KB Output is correct
6 Correct 288 ms 3912 KB Output is correct
7 Correct 238 ms 3344 KB Output is correct
8 Correct 250 ms 3144 KB Output is correct
9 Correct 277 ms 3656 KB Output is correct
10 Correct 292 ms 3656 KB Output is correct