Submission #1276210

#TimeUsernameProblemLanguageResultExecution timeMemory
1276210duyanhchupapiBaloni (COCI15_baloni)C++20
100 / 100
61 ms580 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int n, cnt[N], ans;
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("baloni.inp", "r", stdin);
	//freopen("baloni.out", "w", stdout);
    cin >> n;
	while(n--) {
        int h; cin >> h; cnt[h]++;
        if(cnt[h+1]) cnt[h+1]--;
        else ans++;
    }
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...