답안 #42994

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
42994 2018-03-07T17:05:03 Z Mouhanad_Hafez Baloni (COCI15_baloni) C++11
0 / 100
336 ms 19880 KB
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define SI size()
#define pb push_back
using namespace std;
const ll MAX=1000007;
ll i,m,n,sum,a[MAX],ans;
int main(){
    cin>>n;
    for (i=0;i<n;i++){
        ll x;
        scanf ("%I64d",&x);
        if (a[x]==0){
            ans++;
            a[x-1]++;
        }
        if (a[x]==1){
            a[x]--;
            a[x-1]--;

        }
    }
    cout<<ans;
}

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:14:26: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
         scanf ("%I64d",&x);
                          ^
baloni.cpp:14:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf ("%I64d",&x);
                           ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 3 ms 376 KB Output isn't correct
3 Incorrect 4 ms 584 KB Output isn't correct
4 Incorrect 3 ms 720 KB Output isn't correct
5 Incorrect 311 ms 4408 KB Output isn't correct
6 Incorrect 332 ms 7792 KB Output isn't correct
7 Incorrect 286 ms 10880 KB Output isn't correct
8 Incorrect 263 ms 13604 KB Output isn't correct
9 Incorrect 308 ms 16800 KB Output isn't correct
10 Incorrect 336 ms 19880 KB Output isn't correct