Submission #165707

#TimeUsernameProblemLanguageResultExecution timeMemory
165707itiamHindeks (COCI17_hindeks)C++11
25 / 50
1068 ms5752 KiB
#include <iostream> #include <algorithm> #include <cstdio> using namespace std; int L[500005]; int main(){ int N,x,zb,me=0; cin >> N; for (int i=0;i<N;i++){ cin >> x; if (x<=500000) L[x]+=1; else L[500000+1]+=1; if (x>me) me=x; } if (me>=500000){ me=500001; } for (int i=me-1;i>0;i--){ zb=0; for (int j=i;j<=me;j++){ zb+=L[j]; } if (zb==i){ break; } } cout << zb; return 0; }

Compilation message (stderr)

hindeks.cpp: In function 'int main()':
hindeks.cpp:29:10: warning: 'zb' may be used uninitialized in this function [-Wmaybe-uninitialized]
     cout << zb;
     ~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...