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"
using namespace std;
static const int Nmax = 500;
int query(vector<int> q);
vector<int> q[51];
int x[51];
void solve(int N){
if(N <= 7){
for(int i = 0; i < 49; i ++){
q[i] = vector<int>();
for(int j = 1; j <= N; j ++){
q[i].push_back(j);
}
random_shuffle(q[i].begin(), q[i].end());
x[i] = query(q[i]);
if(x[i] == N){return;}
}
vector<int> p;
for(int i = 1; i < N+1; i ++){
p.push_back(i);
}
do{
int match = 1;
for(int k = 0; k < 49; k ++){
int score = 0;
for(int i = 0; i < N; i ++){
score += (p[i] == q[k][i]);
}
if(score != x[k]){
match = 0;
}
}
if(match){query(p);return;}
}while(next_permutation(p.begin(), p.end()));
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |