답안 #956300

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
956300 2024-04-01T14:26:45 Z Ariadna Baloni (COCI15_baloni) C++14
100 / 100
181 ms 14372 KB
#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; ++i) cin >> h[i];

    unordered_map<int, int> m;
    m.reserve(n);
    int arrows = 0;
    for (int i = 0; i < n; ++i) {
        ++m[h[i]];
        if (m[h[i]+1] > 0) {
            --m[h[i]+1];
            continue;
        }
        ++arrows;
    }
    cout << arrows << '\n';

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 444 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 163 ms 13488 KB Output is correct
6 Correct 160 ms 14372 KB Output is correct
7 Correct 128 ms 11980 KB Output is correct
8 Correct 181 ms 12116 KB Output is correct
9 Correct 164 ms 12476 KB Output is correct
10 Correct 140 ms 13240 KB Output is correct