Submission #382138

# Submission time Handle Problem Language Result Execution time Memory
382138 2021-03-26T13:19:17 Z BlancaHM Baloni (COCI15_baloni) C++14
100 / 100
454 ms 7404 KB
#include <iostream>
#include <map>
using namespace std;

int main() {
	int N;
	cin >> N;
	int H[N];
	for (int i = 0; i < N; i++)
		cin >> H[i];
	map<int, int> arrows;
	for (int i = 0; i < N; i++) {
		if (arrows.find(H[i]) != arrows.end() && arrows[H[i]] > 0)
			arrows[H[i]]--;
		arrows[H[i]-1]++;
	}
	int ans = 0;
	for (auto it = arrows.begin(); it != arrows.end(); it++)
		ans += it->second;
	cout << ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 3 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 454 ms 7276 KB Output is correct
6 Correct 449 ms 7404 KB Output is correct
7 Correct 350 ms 6208 KB Output is correct
8 Correct 364 ms 6048 KB Output is correct
9 Correct 401 ms 6764 KB Output is correct
10 Correct 389 ms 6764 KB Output is correct