Submission #31729

#TimeUsernameProblemLanguageResultExecution timeMemory
31729simotionBaloni (COCI15_baloni)C++14
100 / 100
116 ms9828 KiB
#include <bits/stdc++.h> using namespace std; int inp[1000002],n,h[1000002],sum; int main() { scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",&inp[i]); sum++,h[inp[n-1]]++; for(int i=n-2;i>=0;i--) { if(h[inp[i]-1]) h[inp[i]-1]--; else sum++; h[inp[i]]++; } printf("%d",sum); }

Compilation message (stderr)

baloni.cpp: In function 'int main()':
baloni.cpp:5:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
baloni.cpp:6:45: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<n;i++) scanf("%d",&inp[i]);
                                             ^
#Verdict Execution timeMemoryGrader output
Fetching results...