#include <grader.h>
#include <stdio.h>
#include <stdlib.h>
#include <set>
#include <vector>
#include <time.h>
#define MAXN 256
int solved[MAXN];
std::set <int> cand[MAXN],used;
std::vector <int> q;
int ramase[MAXN];
void fill(int n){
int i,j,n2;
n2=n;
for(i=0; i<n2; i++){
ramase[i]=i+1;
}
for(auto x : used){
ramase[x-1]=0;
}
for(i=0; i<n2; i++){
if(ramase[i]==0){
for(j=i+1; j<n2; j++){
ramase[j-1]=ramase[j];
}
n2--;
}
}
for(i=0; i<n; i++){
if(solved[i]==0){
j=rand()%n2;
q[j]=ramase[j];
for(j=j+1; j<n2; j++){
ramase[j-1]=ramase[j];
}
n2--;
}
}
}
int solve(int N)
{
srand(time(NULL));
int i,j,x,n=N;
auto y=used.begin();
for(i=0; i<n; i++){
for(j=1; j<=n; j++){
cand[i].insert(j);
}
}
for(i=0; i<n; i++){
x=0;
while(solved[x]==1)
x++;
for(j=x+1; j<n; j++){
if((int)cand[j].size()<(int)cand[x].size())
x=j;
}
y=cand[x].begin();
y--;
while((int)cand[i].size()>1){
y++;
if(y==cand[x].end())
y=cand[x].begin();
q[x+1]=*y;
used.insert(*y);
fill(n);
if(query(q)==i){
for(j=i; j<n; j++)
cand[j].erase(cand[j].find(q[j]));
}
}
}
return 0;
}
Compilation message
mouse.cpp:44:5: error: ambiguating new declaration of 'int solve(int)'
44 | int solve(int N)
| ^~~~~
In file included from mouse.cpp:1:
grader.h:8:6: note: old declaration 'void solve(int)'
8 | void solve(int N);
| ^~~~~