답안 #162698

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
162698 2019-11-09T11:24:07 Z wjoao Baloni (COCI15_baloni) C++11
100 / 100
357 ms 3832 KB
#include<bits/stdc++.h>
#define maxn 1000100
using namespace std;

int mark[maxn], a, entrada[maxn], n;

int main(){
  cin >> n;

  int res = 0;

  for(int i =0 ; i < n; i++){
    cin >> entrada[i];
  }


  for(int i = n-1; i>= 0; i--){
    int h = entrada[i];

    if( mark[h-1] > 0 ){
      mark[h-1]--;
    }else{
      res++;
    }
      mark[h]++;
  }


  cout << res << endl;
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
5 Correct 331 ms 3440 KB Output is correct
6 Correct 357 ms 3832 KB Output is correct
7 Correct 269 ms 3252 KB Output is correct
8 Correct 269 ms 3192 KB Output is correct
9 Correct 308 ms 3392 KB Output is correct
10 Correct 301 ms 3576 KB Output is correct