Submission #206706

#TimeUsernameProblemLanguageResultExecution timeMemory
206706mayhoubsalehCONSUL (info1cup19_consul)C++14
0 / 100
6 ms376 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; void solve(int n) { bool vis[1010]; memset(vis,0,sizeof vis); int x=min(n-1,59); map<int,int>res; while(x--){ int id=rand()%n+1; if(vis[id])continue; vis[id]=1; int val=kth(id); res[val]++; if(res[val]>n/3){ say_answer(val); return; } } pair<int,int>mx={-1,-1}; for(auto x:res){ if(x.second>mx.second){ mx=x; } } if(cnt(mx.first)>n/3){ say_answer(mx.second); return ; } say_answer(-1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...