#include "swaps.h"
#include <bits/stdc++.h>
#define sz(a) (int)(a.size())
using namespace std;
void solve(int n,int V){
vector<int>cur;
vector<int>ans;
for(int i=1;i<=n;i++)cur.push_back(i);
for(int i=1;i<n;i++){
vector<int>v = cur;
while(sz(v)>1){
vector<int>nw;
int m = sz(v);
for(int j=0;j+1<m;j+=2)schedule(v[j],v[j+1]);
vector<int>res = visit();
int c = 0;
for(int j=0;j+1<m;j+=2){
if(res[c])nw.push_back(v[j+1]);
else nw.push_back(v[j]);
c++;
}
if(m&1)nw.push_back(v.back());
v = nw;
}
ans.push_back(v.back());
v.clear();
for(int x:cur){
if(x!=ans.back())v.push_back(x);
}
cur = v;
}
ans.push_back(cur.back());
reverse(ans.begin(),ans.end());
answer(ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Correct |
2 |
Correct |
8 ms |
208 KB |
Correct |
3 |
Correct |
20 ms |
436 KB |
Correct |
4 |
Correct |
70 ms |
312 KB |
Correct |
5 |
Correct |
78 ms |
316 KB |
Correct |
6 |
Correct |
77 ms |
560 KB |
Correct |
7 |
Correct |
71 ms |
312 KB |
Correct |
8 |
Correct |
76 ms |
412 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
8 ms |
208 KB |
Correct |
3 |
Correct |
22 ms |
308 KB |
Correct |
4 |
Correct |
76 ms |
308 KB |
Correct |
5 |
Correct |
74 ms |
316 KB |
Correct |
6 |
Correct |
69 ms |
320 KB |
Correct |
7 |
Correct |
71 ms |
428 KB |
Correct |
8 |
Correct |
72 ms |
316 KB |
Correct |
9 |
Runtime error |
30 ms |
372 KB |
Execution killed with signal 11 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
8 ms |
300 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
8 ms |
300 KB |
Correct |
3 |
Correct |
1 ms |
208 KB |
Correct |
4 |
Correct |
7 ms |
208 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
9 ms |
288 KB |
Correct |
3 |
Correct |
25 ms |
308 KB |
Correct |
4 |
Correct |
49 ms |
328 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
9 ms |
288 KB |
Correct |
3 |
Correct |
25 ms |
308 KB |
Correct |
4 |
Correct |
49 ms |
328 KB |
Correct |
5 |
Correct |
1 ms |
208 KB |
Correct |
6 |
Correct |
7 ms |
300 KB |
Correct |
7 |
Correct |
27 ms |
308 KB |
Correct |
8 |
Correct |
51 ms |
316 KB |
Correct |
9 |
Correct |
68 ms |
320 KB |
Correct |
10 |
Correct |
69 ms |
432 KB |
Correct |
11 |
Correct |
55 ms |
320 KB |
Correct |
12 |
Correct |
82 ms |
316 KB |
Correct |
13 |
Correct |
1 ms |
208 KB |
Correct |
14 |
Correct |
5 ms |
300 KB |
Correct |
15 |
Correct |
24 ms |
424 KB |
Correct |
16 |
Correct |
73 ms |
536 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
8 ms |
208 KB |
Correct |
3 |
Correct |
27 ms |
308 KB |
Correct |
4 |
Correct |
72 ms |
420 KB |
Correct |
5 |
Runtime error |
14 ms |
420 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
8 ms |
208 KB |
Correct |
3 |
Correct |
27 ms |
308 KB |
Correct |
4 |
Correct |
72 ms |
420 KB |
Correct |
5 |
Runtime error |
14 ms |
420 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
7 ms |
208 KB |
Correct |
3 |
Correct |
21 ms |
312 KB |
Correct |
4 |
Correct |
75 ms |
312 KB |
Correct |
5 |
Runtime error |
12 ms |
328 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
7 ms |
208 KB |
Correct |
3 |
Correct |
21 ms |
312 KB |
Correct |
4 |
Correct |
75 ms |
312 KB |
Correct |
5 |
Runtime error |
12 ms |
328 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
7 ms |
208 KB |
Correct |
3 |
Correct |
27 ms |
316 KB |
Correct |
4 |
Correct |
70 ms |
308 KB |
Correct |
5 |
Runtime error |
12 ms |
324 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Correct |
2 |
Correct |
7 ms |
208 KB |
Correct |
3 |
Correct |
27 ms |
316 KB |
Correct |
4 |
Correct |
70 ms |
308 KB |
Correct |
5 |
Runtime error |
12 ms |
324 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |