답안 #383755

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
383755 2021-03-30T19:07:16 Z Alma Baloni (COCI15_baloni) C++14
100 / 100
93 ms 10604 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 7020 KB Output is correct
2 Correct 7 ms 7020 KB Output is correct
3 Correct 7 ms 7020 KB Output is correct
4 Correct 6 ms 7020 KB Output is correct
5 Correct 93 ms 10604 KB Output is correct
6 Correct 83 ms 10604 KB Output is correct
7 Correct 69 ms 9964 KB Output is correct
8 Correct 67 ms 9836 KB Output is correct
9 Correct 75 ms 10220 KB Output is correct
10 Correct 74 ms 10220 KB Output is correct