Submission #1112474

#TimeUsernameProblemLanguageResultExecution timeMemory
1112474vjudge1Baloni (COCI15_baloni)C++98
100 / 100
140 ms3896 KiB
#include <iostream> #include <vector> #include <unordered_map> using namespace std; int main() { int N; cin >> N; vector<int> heights(N); for (int i = 0; i < N; ++i) { cin >> heights[i]; } unordered_map<int, int> arrows; int num_arrows = 0; for (int i = 0; i < N; ++i) { int h = heights[i]; if (arrows[h] > 0) { arrows[h]--; arrows[h - 1]++; } else { num_arrows++; arrows[h - 1]++; } } cout << num_arrows << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...