#include <bits/stdc++.h>
#include "library.h"
using namespace std;
void Solve(int N){
if(N <= 2){
vector<int>ans;
for(int i=1;i<=N;i++)ans.push_back(i);
Answer(ans);
return;
}
int A[N+1];
for(int i=1;i<=N;i++)A[i] = 0;
vector<int>v;
for(int i=1;i<=N;i++)v.push_back(1);
vector<int>fin;
for(int i=1;i<=N;i++){
v[i-1] = 0;
int ans = Query(v);
if(ans == 1){fin.push_back(i), A[i] = 1; break;}
v[i-1] = 1;
}
for(int i=2;i<=N;i++){
int x = fin.back();
v.clear();
for(int k=0;k<N;k++)v.push_back(0);
v[x-1] = 1;
for(int j=1;j<=N;j++){
if(A[j])continue;
v[j-1] = 1;
int ans = Query(v);
if(ans == 1){fin.push_back(j), A[j] = 1; break;}
v[j-1] = 0;
}
}
Answer(fin);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
208 KB |
# of queries: 9387 |
2 |
Correct |
131 ms |
208 KB |
# of queries: 9921 |
3 |
Correct |
153 ms |
208 KB |
# of queries: 10593 |
4 |
Correct |
129 ms |
208 KB |
# of queries: 9984 |
5 |
Correct |
138 ms |
208 KB |
# of queries: 10491 |
6 |
Correct |
112 ms |
208 KB |
# of queries: 9332 |
7 |
Correct |
122 ms |
208 KB |
# of queries: 10200 |
8 |
Correct |
114 ms |
208 KB |
# of queries: 9064 |
9 |
Correct |
138 ms |
208 KB |
# of queries: 10493 |
10 |
Correct |
55 ms |
208 KB |
# of queries: 4192 |
11 |
Correct |
0 ms |
208 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
208 KB |
# of queries: 0 |
13 |
Correct |
1 ms |
208 KB |
# of queries: 4 |
14 |
Correct |
1 ms |
208 KB |
# of queries: 5 |
15 |
Correct |
2 ms |
208 KB |
# of queries: 76 |
16 |
Correct |
3 ms |
208 KB |
# of queries: 182 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
208 KB |
# of queries: 9387 |
2 |
Correct |
131 ms |
208 KB |
# of queries: 9921 |
3 |
Correct |
153 ms |
208 KB |
# of queries: 10593 |
4 |
Correct |
129 ms |
208 KB |
# of queries: 9984 |
5 |
Correct |
138 ms |
208 KB |
# of queries: 10491 |
6 |
Correct |
112 ms |
208 KB |
# of queries: 9332 |
7 |
Correct |
122 ms |
208 KB |
# of queries: 10200 |
8 |
Correct |
114 ms |
208 KB |
# of queries: 9064 |
9 |
Correct |
138 ms |
208 KB |
# of queries: 10493 |
10 |
Correct |
55 ms |
208 KB |
# of queries: 4192 |
11 |
Correct |
0 ms |
208 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
208 KB |
# of queries: 0 |
13 |
Correct |
1 ms |
208 KB |
# of queries: 4 |
14 |
Correct |
1 ms |
208 KB |
# of queries: 5 |
15 |
Correct |
2 ms |
208 KB |
# of queries: 76 |
16 |
Correct |
3 ms |
208 KB |
# of queries: 182 |
17 |
Runtime error |
423 ms |
292 KB |
Execution killed with signal 13 |
18 |
Halted |
0 ms |
0 KB |
- |