Submission #1116533

# Submission time Handle Problem Language Result Execution time Memory
1116533 2024-11-21T19:05:11 Z vjudge1 Baloni (COCI15_baloni) C++17
100 / 100
162 ms 10828 KB
#include <bits/stdc++.h>
#define int long long 
using namespace std;
int h[1000001];
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,ans=0;
	cin >> n;
	for(int i=0;i<n;i++)cin >> h[i];
	map<int,int> mp;
	for(int i=0;i<n;i++){
		if(mp[h[i]]>0){
			mp[h[i]]--;
			mp[h[i]-1]++;
		}
		else{
			ans++;
			mp[h[i]-1]++;
		}
	}
	cout << ans << "\n";
	return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 2 ms 488 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
5 Correct 162 ms 10312 KB Output is correct
6 Correct 138 ms 10828 KB Output is correct
7 Correct 102 ms 8804 KB Output is correct
8 Correct 109 ms 8784 KB Output is correct
9 Correct 134 ms 9552 KB Output is correct
10 Correct 122 ms 9816 KB Output is correct