# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
956175 | lalig777 | Baloni (COCI15_baloni) | C++14 | 135 ms | 4024 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/******************************************************************************
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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |