#include <bits/stdc++.h>
#include "library.h"
using namespace std;
void Solve(int N)
{
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 |
250 ms |
376 KB |
# of queries: 18336 |
2 |
Correct |
256 ms |
376 KB |
# of queries: 18145 |
3 |
Correct |
298 ms |
504 KB |
# of queries: 19900 |
4 |
Correct |
294 ms |
376 KB |
# of queries: 19900 |
5 |
Correct |
294 ms |
384 KB |
# of queries: 19900 |
6 |
Correct |
324 ms |
632 KB |
# of queries: 19900 |
7 |
Correct |
334 ms |
256 KB |
# of queries: 19900 |
8 |
Correct |
235 ms |
376 KB |
# of queries: 18528 |
9 |
Correct |
288 ms |
376 KB |
# of queries: 19701 |
10 |
Correct |
88 ms |
256 KB |
# of queries: 8256 |
11 |
Runtime error |
1 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
250 ms |
376 KB |
# of queries: 18336 |
2 |
Correct |
256 ms |
376 KB |
# of queries: 18145 |
3 |
Correct |
298 ms |
504 KB |
# of queries: 19900 |
4 |
Correct |
294 ms |
376 KB |
# of queries: 19900 |
5 |
Correct |
294 ms |
384 KB |
# of queries: 19900 |
6 |
Correct |
324 ms |
632 KB |
# of queries: 19900 |
7 |
Correct |
334 ms |
256 KB |
# of queries: 19900 |
8 |
Correct |
235 ms |
376 KB |
# of queries: 18528 |
9 |
Correct |
288 ms |
376 KB |
# of queries: 19701 |
10 |
Correct |
88 ms |
256 KB |
# of queries: 8256 |
11 |
Runtime error |
1 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Halted |
0 ms |
0 KB |
- |