Submission #898485

#TimeUsernameProblemLanguageResultExecution timeMemory
898485BlagojBaloni (COCI15_baloni)C++17
0 / 100
46 ms3916 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++;
            cnt[x]++;
        }
        cnt[x - 1]++;
    }
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...