Submission #141428

# Submission time Handle Problem Language Result Execution time Memory
141428 2019-08-08T04:40:00 Z meatrow Baloni (COCI15_baloni) C++17
100 / 100
127 ms 7416 KB
//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    unordered_map<int, int> a;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[h[i]]) {
            a[h[i]]--;
        } else {
            ans++;
        }
        a[h[i] - 1]++;
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 124 ms 7160 KB Output is correct
6 Correct 127 ms 7416 KB Output is correct
7 Correct 101 ms 6136 KB Output is correct
8 Correct 101 ms 6008 KB Output is correct
9 Correct 113 ms 6600 KB Output is correct
10 Correct 115 ms 6784 KB Output is correct