Submission #364127

#TimeUsernameProblemLanguageResultExecution timeMemory
364127sobaCONSUL (info1cup19_consul)C++14
100 / 100
37 ms512 KiB
#include <bits/stdc++.h> #include "grader.h" //#include "grader.cpp" using namespace std; void solve(int n) { int need=(n)/3; need++; vector<int>v; for(int i=1; i <= n ; i++) { v.push_back(i); } random_shuffle(v.begin(), v.end()); random_shuffle(v.begin(), v.end()); random_shuffle(v.begin(), v.end()); int cn=1 , ans=-1; map<int,int>mp; for(int i = 1 ; i<=min(30,need) ; i++) { int x=kth(v[i]); if(mp[x]) continue; else mp[x]=cnt(x); if(mp[x]>=need) { ans=x; break; } } say_answer(ans); }

Compilation message (stderr)

consul.cpp: In function 'void solve(int)':
consul.cpp:17:9: warning: unused variable 'cn' [-Wunused-variable]
   17 |     int cn=1 , ans=-1;
      |         ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...