Submission #163865

#TimeUsernameProblemLanguageResultExecution timeMemory
163865beso123Baloni (COCI15_baloni)C++14
100 / 100
338 ms10888 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int n,a[1000001],used[1000001]; main(){ scanf("%i64d",&n); for(int k=1;k<=n;k++) scanf("%I64d",&a[k]); int ans=0; ans++; used[a[1]]++; for(int k=2;k<=n;k++){ if(used[a[k]+1]==0) ans++; else used[a[k]+1]--; used[a[k]]++; } cout<<ans; return 0; }

Compilation message (stderr)

baloni.cpp:5:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
baloni.cpp: In function 'int main()':
baloni.cpp:6:17: warning: format '%i' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
 scanf("%i64d",&n);
               ~~^
baloni.cpp:8:24: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
     scanf("%I64d",&a[k]);
                   ~~~~~^
baloni.cpp:6:6: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf("%i64d",&n);
 ~~~~~^~~~~~~~~~~~
baloni.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%I64d",&a[k]);
     ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...