Submission #315026

#TimeUsernameProblemLanguageResultExecution timeMemory
315026daniel920712CONSUL (info1cup19_consul)C++14
19 / 100
830 ms2168 KiB
#include "grader.h" #include <map> using namespace std; map < int , int > all; void solve(int n) { int i,t,big; for(i=1;i<=n;i++) { t=kth(i); all[t]++; big=max(big,all[t]); if(all[t]>n/3) { say_answer(t); return; } if(big+(n-i)<=n/3) { say_answer(-1); return; } } say_answer(-1); }

Compilation message (stderr)

consul.cpp: In function 'void solve(int)':
consul.cpp:7:13: warning: 'big' may be used uninitialized in this function [-Wmaybe-uninitialized]
    7 |     int i,t,big;
      |             ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...