답안 #357892

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
357892 2021-01-24T23:14:13 Z beepbeepsheep Baloni (COCI15_baloni) C++17
100 / 100
71 ms 11884 KB
#include <bits/stdc++.h>

using namespace std;
#define ll long long

const ll bignum=1e17;
const int inf= 2e9;
const int mod= 1e9+7;


ll arr[1000001];
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    memset(arr,0,sizeof(arr));
    ll n,ele,ans=0;
    cin>>n;
    for (int i=0;i<n;i++){
        cin>>ele;
        if (arr[ele]==0){
            ans++;
            arr[ele-1]++;
        }
        else{
            arr[ele]--;
            arr[ele-1]++;
        }
    }
    cout<<ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 8172 KB Output is correct
2 Correct 4 ms 8172 KB Output is correct
3 Correct 5 ms 8172 KB Output is correct
4 Correct 4 ms 8172 KB Output is correct
5 Correct 71 ms 11884 KB Output is correct
6 Correct 71 ms 11756 KB Output is correct
7 Correct 57 ms 11116 KB Output is correct
8 Correct 57 ms 10988 KB Output is correct
9 Correct 65 ms 11500 KB Output is correct
10 Correct 66 ms 11372 KB Output is correct