제출 #232033

#제출 시각아이디문제언어결과실행 시간메모리
232033BlerarghBaloni (COCI15_baloni)C++17
100 / 100
78 ms4352 KiB
#include <bits/stdc++.h>
using namespace std;
 
const int MAXN = 1e6+5;
 
int main(){
  	ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
    int heights[MAXN];
    memset(heights, 0, sizeof(heights));
    int n; cin >> n;
    int cnt=0;
    for (int i=0; i<n; i++){
        int x;
        cin >> x;
        if (heights[x]) heights[x]--;
        else cnt++;
        heights[x-1]++;
    }
    cout << cnt;
}
#Verdict Execution timeMemoryGrader output
Fetching results...