답안 #956180

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
956180 2024-04-01T09:02:04 Z lalig777 Baloni (COCI15_baloni) C++14
100 / 100
135 ms 7268 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main(){
    int n, ans=0; cin>>n;
    vector<int>v(1e6, 0);
    while (n--){
        int a; cin>>a;
        if (v[a-1]>0){
            v[a-1]--;
            if (a-2>=0) v[a-2]++;
        }else{
            ans++;
            if (a-2>=0) v[a-2]++;
        }
    }cout<<ans<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4192 KB Output is correct
2 Correct 2 ms 4280 KB Output is correct
3 Correct 3 ms 4188 KB Output is correct
4 Correct 2 ms 4188 KB Output is correct
5 Correct 135 ms 7268 KB Output is correct
6 Correct 135 ms 7248 KB Output is correct
7 Correct 110 ms 6888 KB Output is correct
8 Correct 114 ms 6752 KB Output is correct
9 Correct 122 ms 6992 KB Output is correct
10 Correct 122 ms 6996 KB Output is correct