답안 #466987

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
466987 2021-08-21T07:23:09 Z MKutayBozkurt Baloni (COCI15_baloni) C++14
100 / 100
98 ms 11180 KB
#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';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4172 KB Output is correct
2 Correct 2 ms 4172 KB Output is correct
3 Correct 3 ms 4172 KB Output is correct
4 Correct 3 ms 4172 KB Output is correct
5 Correct 82 ms 10808 KB Output is correct
6 Correct 98 ms 11180 KB Output is correct
7 Correct 68 ms 9916 KB Output is correct
8 Correct 70 ms 9916 KB Output is correct
9 Correct 77 ms 10312 KB Output is correct
10 Correct 77 ms 10440 KB Output is correct