#include <bits/stdc++.h>
#include "library.h"
using namespace std;
void Solve(int N)
{
if(N==1){
Answer({1});
return;}
vector<vector<int> > a(N+1);
vector<int> M(N);
for(int i=1;i<=N;i++)
for(int j=1;j<i;j++){
M[i-1]=1;
M[j-1]=1;
int p=Query(M);
if(p==1){
a[i].push_back(j);
a[j].push_back(i);
}
M[i-1]=0;
M[j-1]=0;
}
int in=-1;
for(int i=1;i<=N;i++)if(a[i].size()==1)in=i;
vector<int> sol;
sol.push_back(in);
M[in-1]=1;
in=a[in][0];
while(a[in].size()!=1){
sol.push_back(in);
M[in-1]=1;
if(M[a[in][0]-1])in=a[in][1];
else in=a[in][0];
}
sol.push_back(in);
Answer(sol);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
245 ms |
376 KB |
# of queries: 18336 |
2 |
Correct |
240 ms |
376 KB |
# of queries: 18145 |
3 |
Correct |
255 ms |
504 KB |
# of queries: 19900 |
4 |
Correct |
287 ms |
384 KB |
# of queries: 19900 |
5 |
Correct |
257 ms |
376 KB |
# of queries: 19900 |
6 |
Correct |
269 ms |
632 KB |
# of queries: 19900 |
7 |
Correct |
239 ms |
384 KB |
# of queries: 19900 |
8 |
Correct |
269 ms |
376 KB |
# of queries: 18528 |
9 |
Correct |
320 ms |
376 KB |
# of queries: 19701 |
10 |
Correct |
131 ms |
256 KB |
# of queries: 8256 |
11 |
Correct |
0 ms |
256 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
256 KB |
# of queries: 1 |
13 |
Correct |
1 ms |
256 KB |
# of queries: 3 |
14 |
Correct |
1 ms |
256 KB |
# of queries: 6 |
15 |
Correct |
2 ms |
256 KB |
# of queries: 105 |
16 |
Correct |
6 ms |
256 KB |
# of queries: 351 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
245 ms |
376 KB |
# of queries: 18336 |
2 |
Correct |
240 ms |
376 KB |
# of queries: 18145 |
3 |
Correct |
255 ms |
504 KB |
# of queries: 19900 |
4 |
Correct |
287 ms |
384 KB |
# of queries: 19900 |
5 |
Correct |
257 ms |
376 KB |
# of queries: 19900 |
6 |
Correct |
269 ms |
632 KB |
# of queries: 19900 |
7 |
Correct |
239 ms |
384 KB |
# of queries: 19900 |
8 |
Correct |
269 ms |
376 KB |
# of queries: 18528 |
9 |
Correct |
320 ms |
376 KB |
# of queries: 19701 |
10 |
Correct |
131 ms |
256 KB |
# of queries: 8256 |
11 |
Correct |
0 ms |
256 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
256 KB |
# of queries: 1 |
13 |
Correct |
1 ms |
256 KB |
# of queries: 3 |
14 |
Correct |
1 ms |
256 KB |
# of queries: 6 |
15 |
Correct |
2 ms |
256 KB |
# of queries: 105 |
16 |
Correct |
6 ms |
256 KB |
# of queries: 351 |
17 |
Execution timed out |
2272 ms |
384 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |