제출 #383755

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n, h, t = 0;
    vector<stack<int>> vs(1e4+2, stack<int>());
    cin >> n;
    while (n--) {
        cin >> h;
        if (vs[h+1].empty())
            t++;
        else
            vs[h+1].pop();
        vs[h].push(h);
    }
    cout << t << '\n';
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...