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"
//#include "grader.cpp"
using namespace std;
void solve(int n){
int a[1005];
for(int i = 0 ; i < n ; i ++){
int x = kth(i + 1);
a[i] = x;
}
sort(a,a + n);
int cnt = 1;
for(int i = 1 ; i < n ; i ++){
if(a[i] != a[i - 1]){
if(cnt > n / 3){
say_answer(a[i - 1]);
return;
}
cnt = 0;
}
cnt ++;
//cout << a[i] << " " << cnt << endl;
}
if(cnt > n / 3){
say_answer(a[n]);
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... |