#include <swaps.h>
#include<cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <iostream>
using namespace std;
/*void schedule(int i, int j){
cout << "schedule " << i << " " << j << "\n" << flush;
}
vector<int> visit(){
cout << "visit\n" << flush;
int n;
cin >> n;
vector<int> ans(n);
for(int i=0; i<n; i++){
cin >> ans[i];
}
cout << "Yes: " << n << "\n";
return ans;
}
void answer(vector<int>& ans){
cout << "answer: \n";
for(auto e: ans){
cout << e << " ";
}
cout << "\n" << flush;
}*/
void solve(int n, int v){
vector<vector<int> > op(n);
for(int i=0; i<n; i++){
op[0].push_back(i+1);
}
int q=0;
while(true){
int cnt=0;
for(int j=0; j<n; j++){
for(int k=0; k+1<(int)op[j].size(); k+=2){
schedule(op[j][k], op[j][k+1]);
cnt++;
}
}
if(cnt==0) break;
if(q==v) answer({1, 2, 3});
vector<int> resp=visit();
q++;
int ind=0;
vector<vector<int> > op2(n);
for(int j=0; j<n; j++){
if(op[j].size()%2==1){
op2[j].push_back(op[j][op[j].size()-1]);
}
for(int k=0; k+1<(int)op[j].size(); k+=2){
if(resp[ind]){
op2[j].push_back(op[j][k]);
op2[j+1].push_back(op[j][k+1]);
}
else{
op2[j+1].push_back(op[j][k]);
op2[j].push_back(op[j][k+1]);
}
ind++;
}
}
op=op2;
}
vector<int> ans(n);
for(int i=0; i<n; i++){
assert(op[i].size()==1);
ans[i]=op[i][0];
}
answer(ans);
}
/*signed main(){
int n, v;
cin >> n >> v;
solve(n, v);
}*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
8 ms |
208 KB |
Correct |
3 |
Correct |
27 ms |
316 KB |
Correct |
4 |
Correct |
80 ms |
352 KB |
Correct |
5 |
Correct |
81 ms |
460 KB |
Correct |
6 |
Correct |
84 ms |
396 KB |
Correct |
7 |
Correct |
86 ms |
400 KB |
Correct |
8 |
Correct |
69 ms |
404 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
5 ms |
208 KB |
Correct |
3 |
Correct |
28 ms |
316 KB |
Correct |
4 |
Correct |
87 ms |
400 KB |
Correct |
5 |
Correct |
73 ms |
384 KB |
Correct |
6 |
Correct |
78 ms |
372 KB |
Correct |
7 |
Correct |
80 ms |
396 KB |
Correct |
8 |
Correct |
80 ms |
368 KB |
Correct |
9 |
Correct |
80 ms |
368 KB |
Correct |
10 |
Correct |
83 ms |
396 KB |
Correct |
11 |
Correct |
86 ms |
492 KB |
Correct |
12 |
Correct |
71 ms |
360 KB |
Correct |
13 |
Correct |
71 ms |
360 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
220 KB |
Correct |
2 |
Correct |
5 ms |
220 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
220 KB |
Correct |
2 |
Correct |
5 ms |
220 KB |
Correct |
3 |
Correct |
1 ms |
220 KB |
Correct |
4 |
Correct |
6 ms |
316 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
220 KB |
Correct |
2 |
Correct |
6 ms |
312 KB |
Correct |
3 |
Correct |
22 ms |
332 KB |
Correct |
4 |
Correct |
100 ms |
392 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
220 KB |
Correct |
2 |
Correct |
6 ms |
312 KB |
Correct |
3 |
Correct |
22 ms |
332 KB |
Correct |
4 |
Correct |
100 ms |
392 KB |
Correct |
5 |
Correct |
0 ms |
220 KB |
Correct |
6 |
Correct |
6 ms |
208 KB |
Correct |
7 |
Correct |
27 ms |
312 KB |
Correct |
8 |
Correct |
86 ms |
400 KB |
Correct |
9 |
Correct |
81 ms |
484 KB |
Correct |
10 |
Correct |
68 ms |
432 KB |
Correct |
11 |
Correct |
76 ms |
412 KB |
Correct |
12 |
Correct |
69 ms |
400 KB |
Correct |
13 |
Correct |
0 ms |
208 KB |
Correct |
14 |
Correct |
8 ms |
316 KB |
Correct |
15 |
Correct |
27 ms |
328 KB |
Correct |
16 |
Correct |
89 ms |
404 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
4 ms |
312 KB |
Correct |
3 |
Correct |
25 ms |
320 KB |
Correct |
4 |
Correct |
76 ms |
396 KB |
Correct |
5 |
Incorrect |
41 ms |
328 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
4 ms |
312 KB |
Correct |
3 |
Correct |
25 ms |
320 KB |
Correct |
4 |
Correct |
76 ms |
396 KB |
Correct |
5 |
Incorrect |
41 ms |
328 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
5 ms |
208 KB |
Correct |
3 |
Correct |
25 ms |
324 KB |
Correct |
4 |
Correct |
78 ms |
404 KB |
Correct |
5 |
Incorrect |
54 ms |
356 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
5 ms |
208 KB |
Correct |
3 |
Correct |
25 ms |
324 KB |
Correct |
4 |
Correct |
78 ms |
404 KB |
Correct |
5 |
Incorrect |
54 ms |
356 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
6 ms |
312 KB |
Correct |
3 |
Correct |
30 ms |
328 KB |
Correct |
4 |
Correct |
91 ms |
388 KB |
Correct |
5 |
Incorrect |
50 ms |
356 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
6 ms |
312 KB |
Correct |
3 |
Correct |
30 ms |
328 KB |
Correct |
4 |
Correct |
91 ms |
388 KB |
Correct |
5 |
Incorrect |
50 ms |
356 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |