Submission #40955

#TimeUsernameProblemLanguageResultExecution timeMemory
40955IvanCBaloni (COCI15_baloni)C++14
100 / 100
131 ms604 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 10; int freq[MAXN],N,ans; int main(){ scanf("%d",&N); for(int i = 1;i<=N;i++){ int x; scanf("%d",&x); if(freq[x]){ freq[x]--; freq[x-1]++; } else{ ans++; freq[x-1]++; } } printf("%d\n",ans); return 0; }

Compilation message (stderr)

baloni.cpp: In function 'int main()':
baloni.cpp:6:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&N);
                ^
baloni.cpp:9:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&x);
                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...