#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
set<int> st;
int get_new(int n){
srand((int)time(0));
int i = rand()%n;
while (st.find(i) != st.end()) i = rand()%n;
st.insert(i);
return i;
}
void solve(int n)
{
map<int, int> mp;
int all = 0;
while (true) {
int k = kth(get_new(n));
int k_cnt = cnt(k);
all += k_cnt;
mp[k] = k_cnt;
if (mp[k] > n/3) {
say_answer(k);
return;
}
if (all >= n) {
say_answer(-1);
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... |