Submission #541708

#TimeUsernameProblemLanguageResultExecution timeMemory
541708cristi_aBaloni (COCI15_baloni)C++17
100 / 100
78 ms3912 KiB
#include <bits/stdc++.h>
using namespace std;
const int nmax = 1e6;

int v[nmax+5];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n; cin >> n;
    int nr = 0;
    for(int i=1; i<=n; i++) {
        int x; cin >> x;
        if(v[x+1])
            v[x+1]--;
        else nr++;
        v[x]++;
    }
    cout << nr;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...