Submission #100759

#TimeUsernameProblemLanguageResultExecution timeMemory
100759dalgerokBaloni (COCI15_baloni)C++17
100 / 100
86 ms7908 KiB
#include<bits/stdc++.h>
using namespace std;




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