This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
int kth(int k);
void say_answer(int k);
int cnt(int k);
auto rng=bind(uniform_int_distribution<int>(1,1e9),mt19937(time(0)));
void solve(int n)
{
map<int,int> mp;
int ogr=0;
int q=0;int x=-1;
int cntt=0;
int need=(n/3)+1;
if(n<=50) ogr=50;
else ogr=60;
while(q<ogr && x==-1){
int w=kth(rng()%n+1);q++;
if(mp.count(w) || q==ogr) continue;
int how=cnt(w);cntt+=how;
if(how>=need) x=w;
mp[w]=how;
q++;
}
say_answer(x);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |