Submission #1112499

#TimeUsernameProblemLanguageResultExecution timeMemory
1112499vjudge1Baloni (COCI15_baloni)C++17
100 / 100
169 ms3912 KiB
#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 timeMemoryGrader output
Fetching results...