# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1112456 | vjudge1 | Baloni (COCI15_baloni) | C++17 | 120 ms | 3896 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
int Phsics(int n, const vector<int>& arrows) {
unordered_map<int, int> count;
int arrows_needed = 0;
for (int arrow : arrows) {
if (count[arrow] > 0) {
count[arrow]--;
count[arrow - 1]++;
} else {
arrows_needed++;
count[arrow - 1]++;
}
}
return arrows_needed;
}
int main() {
int n;
cin >> n;
vector<int> arrows(n);
for (int i = 0; i < n; i++) {
cin >> arrows[i];
}
cout << Phsics(n, arrows) << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |