Submission #42994

#TimeUsernameProblemLanguageResultExecution timeMemory
42994Mouhanad_HafezBaloni (COCI15_baloni)C++11
0 / 100
336 ms19880 KiB
#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 (stderr)

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);
                           ^
#Verdict Execution timeMemoryGrader output
Fetching results...