제출 #466987

#제출 시각아이디문제언어결과실행 시간메모리
466987MKutayBozkurtBaloni (COCI15_baloni)C++14
100 / 100
98 ms11180 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int32_t main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n; cin >> n;
  vector<int> a(n); for (int &x : a) cin >> x;
  vector<int> m(1e6 + 5);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    m[a[i]]++;
    if (m[a[i] + 1]) m[a[i] + 1]--;
    else ans++;
  }
  cout << ans << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...