제출 #232029

#제출 시각아이디문제언어결과실행 시간메모리
232029BlerarghBaloni (COCI15_baloni)C++17
100 / 100
283 ms7800 KiB
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1e6+5;

int main(){
    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...