제출 #639701

#제출 시각아이디문제언어결과실행 시간메모리
639701classicBaloni (COCI15_baloni)C++14
100 / 100
62 ms11144 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> h(n);
    vector<int> cnt(1e6 + 1);
    int res = 0;
    for (int i = 0; i < n; i++) {
        int h;
        cin >> h;
        if (!cnt[h]) {
            res += 1;
        } else {
            cnt[h] -= 1;
        }
        cnt[h - 1] += 1;
    }
    cout << res;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...