#include <cstdio>
#include <vector>
#include <iostream>
#include "library.h"
using namespace std;
#define endl '\n'
#define pb push_back
#define F first
#define S second
#define mk make_pair
typedef long long ll;
const int N=1e3+7;
int vis[N];
vector<int>a,b;
void Solve(int n){
vector<int> m;
vector<int> ans;
int x=1;
for(int i=2;i<=n;i++){
m.clear();
for(int j=1;j<=n;j++){
int g=1;
if(j==i)g=0;
m.pb(g);
}
int y=Query(m);
if(y==1){
x=i;
break;
}
}
fill(vis,vis+N,0);
ans.pb(x);vis[x]=1;
for(int i=2;i<=n;i++){
a.clear();
for(int j=1;j<=n;j++){
if(!vis[j])a.pb(j);
}
while(a.size()>1){
b.clear();
while(a.size()>b.size()){
b.pb(a.back());
a.pop_back();
}
m.clear();
for(int j=1;j<=n;j++){
m.pb(0);
}
for(auto j:a)m[j-1]=1;
int val=Query(m);
for(int j=1;j<=n;j++){
if(vis[j])m[j-1]=1;
}
int val2=Query(m);
if(val!=val2){
swap(a,b);
}
}
ans.pb(a[0]);
vis[a[0]]=1;
}
/*for(auto i:ans){
cout<<i<<" ";
}
cout<<endl;*/
Answer(ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
208 KB |
# of queries: 2398 |
2 |
Correct |
26 ms |
208 KB |
# of queries: 2444 |
3 |
Correct |
20 ms |
208 KB |
# of queries: 2651 |
4 |
Correct |
29 ms |
208 KB |
# of queries: 2592 |
5 |
Correct |
28 ms |
208 KB |
# of queries: 2517 |
6 |
Correct |
20 ms |
208 KB |
# of queries: 2534 |
7 |
Correct |
24 ms |
208 KB |
# of queries: 2545 |
8 |
Correct |
25 ms |
208 KB |
# of queries: 2405 |
9 |
Correct |
24 ms |
208 KB |
# of queries: 2535 |
10 |
Correct |
12 ms |
208 KB |
# of queries: 1485 |
11 |
Correct |
1 ms |
208 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
208 KB |
# of queries: 1 |
13 |
Correct |
0 ms |
208 KB |
# of queries: 3 |
14 |
Correct |
0 ms |
208 KB |
# of queries: 9 |
15 |
Correct |
1 ms |
208 KB |
# of queries: 81 |
16 |
Correct |
2 ms |
208 KB |
# of queries: 188 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
208 KB |
# of queries: 2398 |
2 |
Correct |
26 ms |
208 KB |
# of queries: 2444 |
3 |
Correct |
20 ms |
208 KB |
# of queries: 2651 |
4 |
Correct |
29 ms |
208 KB |
# of queries: 2592 |
5 |
Correct |
28 ms |
208 KB |
# of queries: 2517 |
6 |
Correct |
20 ms |
208 KB |
# of queries: 2534 |
7 |
Correct |
24 ms |
208 KB |
# of queries: 2545 |
8 |
Correct |
25 ms |
208 KB |
# of queries: 2405 |
9 |
Correct |
24 ms |
208 KB |
# of queries: 2535 |
10 |
Correct |
12 ms |
208 KB |
# of queries: 1485 |
11 |
Correct |
1 ms |
208 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
208 KB |
# of queries: 1 |
13 |
Correct |
0 ms |
208 KB |
# of queries: 3 |
14 |
Correct |
0 ms |
208 KB |
# of queries: 9 |
15 |
Correct |
1 ms |
208 KB |
# of queries: 81 |
16 |
Correct |
2 ms |
208 KB |
# of queries: 188 |
17 |
Correct |
211 ms |
312 KB |
# of queries: 18013 |
18 |
Correct |
238 ms |
300 KB |
# of queries: 17292 |
19 |
Correct |
255 ms |
300 KB |
# of queries: 17448 |
20 |
Correct |
186 ms |
304 KB |
# of queries: 16284 |
21 |
Correct |
181 ms |
208 KB |
# of queries: 15357 |
22 |
Correct |
203 ms |
328 KB |
# of queries: 17590 |
23 |
Correct |
213 ms |
208 KB |
# of queries: 17251 |
24 |
Correct |
101 ms |
208 KB |
# of queries: 7854 |
25 |
Correct |
203 ms |
312 KB |
# of queries: 17145 |
26 |
Correct |
221 ms |
316 KB |
# of queries: 15966 |
27 |
Correct |
85 ms |
308 KB |
# of queries: 7989 |
28 |
Correct |
220 ms |
312 KB |
# of queries: 16971 |
29 |
Correct |
210 ms |
416 KB |
# of queries: 16952 |
30 |
Correct |
239 ms |
208 KB |
# of queries: 16971 |