# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1112456 | vjudge1 | Baloni (COCI15_baloni) | C++17 | 120 ms | 3896 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |