제출 #1171576

#제출 시각아이디문제언어결과실행 시간메모리
1171576javkhlantogsBaloni (COCI15_baloni)C++20
100 / 100
232 ms7440 KiB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ll n,i,j,k,cnt=0;
	cin>>n;
	vector<ll> h(n);
	map<ll,ll> mp;
	for(i=0 ; i<n ; i++){
		cin>>h[i];
		if(mp[h[i]+1]>0){
			mp[h[i]+1]--;
			mp[h[i]]++;
		}
			else{
				mp[h[i]]++;
				cnt++;
			}
	}
	cout<<cnt;
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...