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 <stdio.h>
#include <random>
#include "grader.h"
#define MAXN 1000
#define MAXQ 60
int viz[MAXN];
void solve( int N ){
std::mt19937 mt( clock() );
int q = MAXQ, i, val;
for( i = 0 ; i < N ; i++ )
viz[i] = 0;
for( ; q-- ; ){
while( viz[i = mt() % N] );
viz[i] = 1;
if( cnt( val = kth( i + 1 ) ) * 3 > N ){
say_answer( val );
return;
}
}
say_answer( -1 );
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |