Submission #1112499

# Submission time Handle Problem Language Result Execution time Memory
1112499 2024-11-14T08:55:10 Z vjudge1 Baloni (COCI15_baloni) C++17
100 / 100
169 ms 3912 KB
#include <bits/stdc++.h>
using namespace std;

int minimumArrows(vector<int>& hs) {
    unordered_map<int, int> arrows;  
    int ac = 0;

    for (int h : hs) {
        if (arrows[h] > 0) {  
            arrows[h]--;
            arrows[h - 1]++;
        } else {  
            ac++;
            arrows[h - 1]++;
        }
    }

    return ac;
}

int main() {
    int N;
    cin >> N;
    vector<int> hs(N);
    for (int i = 0; i < N; i++) {
        cin >> hs[i];
    }
    cout << minimumArrows(hs) << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 2 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
5 Correct 116 ms 3408 KB Output is correct
6 Correct 169 ms 3912 KB Output is correct
7 Correct 129 ms 3292 KB Output is correct
8 Correct 96 ms 3256 KB Output is correct
9 Correct 118 ms 3408 KB Output is correct
10 Correct 105 ms 3600 KB Output is correct