#include "grader.h"
#define pb push_back
// static const int MIN_VALUE = 0, MAX_VALUE = (1e9) - 1;
// static map<int,int> mp;
// static int Q, N, a[5005];
// static bool issol, answer;
vector <int> v;
// void say_answer(int k)
// {
// if(answer)
// {
// cout << "Multiple answers provided for the same testcase!\n";
// exit(0);
// }
// answer = 1;
// if(k == -1)
// {
// if(issol)
// {
// cout << "Wrong answer\n";
// exit(0);
// }
// else cout << "Correct! Number of queries: " << Q << '\n';
// }
// else
// {
// if(!issol || mp[k] <= N/3)
// {
// cout << "Wrong answer\n";
// exit(0);
// }
// else cout << "Correct! Number of queries: " << Q << '\n';
// }
// }
// int cnt(int k)
// {
// ++Q;
// if(!(k>=MIN_VALUE && k<=MAX_VALUE))
// {
// cout << "Wrong query format\n";
// exit(0);
// }
// return mp[k];
// }
// int kth(int k)
// {
// ++Q;
// if(!(k>=1 && k<=N))
// {
// cout << "Wrong query format\n";
// exit(0);
// }
// return a[k];
// }
void solve(int N){
srand(time(0));
for(int i=1;i<=N;i++){
v.pb(i);
}
int q=25;
while(v.size() and q--){
int k,l,num;
k=rand();
k%=(v.size());
l=kth(v[k]);
num=cnt(l);
if(num>N/3){
say_answer(l);
return;
}
v.erase(v.begin()+k);
}
say_answer(-1);
return;
}
// int main()
// {
// int tests, i;
// cin >> tests;
// while(tests--)
// {
// cin >> N; mp.clear();
// Q = 0; issol = 0; answer = 0;
// for(i=1; i<=N; ++i) cin >> a[i], ++mp[a[i]];
// for(i=1; i<=N; ++i) issol |= (mp[a[i]] > N/3);
// solve(N);
// }
// return 0;
// }
Compilation message
consul.cpp:8:1: error: 'vector' does not name a type
8 | vector <int> v;
| ^~~~~~
consul.cpp: In function 'void solve(int)':
consul.cpp:61:11: error: 'time' was not declared in this scope
61 | srand(time(0));
| ^~~~
consul.cpp:61:5: error: 'srand' was not declared in this scope
61 | srand(time(0));
| ^~~~~
consul.cpp:63:9: error: 'v' was not declared in this scope
63 | v.pb(i);
| ^
consul.cpp:66:11: error: 'v' was not declared in this scope
66 | while(v.size() and q--){
| ^
consul.cpp:68:11: error: 'rand' was not declared in this scope
68 | k=rand();
| ^~~~