제출 #1192145

#제출 시각아이디문제언어결과실행 시간메모리
1192145hmmmBaloni (COCI15_baloni)C++20
100 / 100
32 ms3912 KiB
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
int a[N],mp[N];

int main(){
  ios::sync_with_stdio(0); cin.tie(0);
  int n,ans=0;
  cin >> n;
  for(int i=1;i<=n;i++) cin >> a[i];
  for(int i=1;i<=n;i++){
    if(mp[a[i]+1]>0){
      mp[a[i]+1]--;
    }
    else{
      ans++;
    }
    mp[a[i]]++;
  }
  cout << ans;
}
  
#Verdict Execution timeMemoryGrader output
Fetching results...