Submission #898488

#TimeUsernameProblemLanguageResultExecution timeMemory
898488BlagojBaloni (COCI15_baloni)C++17
100 / 100
50 ms484 KiB
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define ll long long
#define all(x) (x).begin(), (x).end()

const int mxh = 1e6 + 10;
int cnt[mxh];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (!cnt[x]) ans++;
        else cnt[x]--;
        cnt[x - 1]++;
    }
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...