제출 #956175

#제출 시각아이디문제언어결과실행 시간메모리
956175lalig777Baloni (COCI15_baloni)C++14
0 / 100
135 ms4024 KiB
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main(){
    int n, ans=0; cin>>n;
    vector<bool>v(1e6, false);
    while (n--){
        int a; cin>>a;
        if (v[a-1]==true){
            v[a-1]=false;
            if (a-2>=0) v[a-2]=true;
        }else{
            ans++;
            if (a-2>=0) v[a-2]=true;
        }
    }cout<<ans<<endl;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...