#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);
}
for(int i=0; i<n; i++){
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;
vector<int> resp=visit();
int ind=0;
vector<vector<int> > op2(n);
for(int j=0; j<n; j++){
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++;
}
if(op[j].size()%2==1){
op2[j].push_back(op[j][op[j].size()-1]);
}
}
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);
}*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
424 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
424 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
428 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
428 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |