답안 #639701

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
639701 2022-09-11T07:15:55 Z classic Baloni (COCI15_baloni) C++14
100 / 100
62 ms 11144 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4180 KB Output is correct
2 Correct 2 ms 4180 KB Output is correct
3 Correct 2 ms 4180 KB Output is correct
4 Correct 3 ms 4180 KB Output is correct
5 Correct 62 ms 10816 KB Output is correct
6 Correct 62 ms 11144 KB Output is correct
7 Correct 51 ms 9904 KB Output is correct
8 Correct 47 ms 9864 KB Output is correct
9 Correct 57 ms 10532 KB Output is correct
10 Correct 55 ms 10400 KB Output is correct