#include <bits/stdc++.h>
using namespace std;
#include "swaps.h"
void solve(int n, int v) {
vector<int> sus;
vector<int> res;
for (int i=1;i<=n;i++) sus.push_back(i);
for (int t=0;t<9;t++) for (int k=t;k>=0;k--) {
for (int i=0;i<n;i++) if ((((i>>k)&1)==(k-t!=0)) && (i+(1<<k)<n) && (((i+(1<<k))>>(t+1))==(i>>(t+1)))) {
schedule(sus[i],sus[i+(1<<k)]);
}
res=visit();
int j=0;
for (int i=0;i<n;i++) if ((((i>>k)&1)==(k-t!=0)) && (i+(1<<k)<n) && (((i+(1<<k))>>(t+1))==(i>>(t+1)))) {
if (res[j]==0) swap(sus[i],sus[i+(1<<k)]);
j++;
}
}
answer(sus);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
596 KB |
Correct |
2 |
Correct |
1 ms |
436 KB |
Correct |
3 |
Correct |
2 ms |
440 KB |
Correct |
4 |
Correct |
3 ms |
704 KB |
Correct |
5 |
Correct |
3 ms |
700 KB |
Correct |
6 |
Correct |
3 ms |
448 KB |
Correct |
7 |
Correct |
3 ms |
456 KB |
Correct |
8 |
Correct |
3 ms |
452 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Correct |
1 ms |
432 KB |
Correct |
3 |
Correct |
2 ms |
444 KB |
Correct |
4 |
Correct |
3 ms |
448 KB |
Correct |
5 |
Correct |
3 ms |
704 KB |
Correct |
6 |
Correct |
3 ms |
704 KB |
Correct |
7 |
Correct |
3 ms |
452 KB |
Correct |
8 |
Correct |
3 ms |
452 KB |
Correct |
9 |
Correct |
3 ms |
456 KB |
Correct |
10 |
Correct |
3 ms |
700 KB |
Correct |
11 |
Correct |
3 ms |
456 KB |
Correct |
12 |
Correct |
3 ms |
704 KB |
Correct |
13 |
Correct |
3 ms |
448 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Correct |
1 ms |
440 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Correct |
1 ms |
440 KB |
Correct |
3 |
Correct |
1 ms |
348 KB |
Correct |
4 |
Correct |
1 ms |
436 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Correct |
2 |
Correct |
1 ms |
612 KB |
Correct |
3 |
Correct |
2 ms |
444 KB |
Correct |
4 |
Correct |
3 ms |
456 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Correct |
2 |
Correct |
1 ms |
612 KB |
Correct |
3 |
Correct |
2 ms |
444 KB |
Correct |
4 |
Correct |
3 ms |
456 KB |
Correct |
5 |
Correct |
1 ms |
548 KB |
Correct |
6 |
Correct |
1 ms |
436 KB |
Correct |
7 |
Correct |
2 ms |
436 KB |
Correct |
8 |
Correct |
3 ms |
452 KB |
Correct |
9 |
Correct |
3 ms |
1204 KB |
Correct |
10 |
Correct |
3 ms |
448 KB |
Correct |
11 |
Correct |
3 ms |
448 KB |
Correct |
12 |
Correct |
4 ms |
452 KB |
Correct |
13 |
Correct |
1 ms |
344 KB |
Correct |
14 |
Correct |
1 ms |
436 KB |
Correct |
15 |
Correct |
2 ms |
444 KB |
Correct |
16 |
Correct |
3 ms |
704 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
1 ms |
436 KB |
Correct |
3 |
Correct |
2 ms |
440 KB |
Correct |
4 |
Correct |
3 ms |
624 KB |
Correct |
5 |
Correct |
3 ms |
964 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
1 ms |
436 KB |
Correct |
3 |
Correct |
2 ms |
440 KB |
Correct |
4 |
Correct |
3 ms |
624 KB |
Correct |
5 |
Correct |
3 ms |
964 KB |
Correct |
6 |
Correct |
1 ms |
344 KB |
Correct |
7 |
Correct |
1 ms |
432 KB |
Correct |
8 |
Correct |
2 ms |
444 KB |
Correct |
9 |
Correct |
3 ms |
452 KB |
Correct |
10 |
Correct |
3 ms |
456 KB |
Correct |
11 |
Correct |
3 ms |
604 KB |
Correct |
12 |
Correct |
3 ms |
696 KB |
Correct |
13 |
Correct |
3 ms |
448 KB |
Correct |
14 |
Correct |
3 ms |
448 KB |
Correct |
15 |
Correct |
3 ms |
448 KB |
Correct |
16 |
Correct |
3 ms |
452 KB |
Correct |
17 |
Correct |
3 ms |
452 KB |
Correct |
18 |
Correct |
3 ms |
448 KB |
Correct |
19 |
Correct |
0 ms |
356 KB |
Correct |
20 |
Correct |
1 ms |
448 KB |
Correct |
21 |
Correct |
2 ms |
624 KB |
Correct |
22 |
Correct |
3 ms |
460 KB |
Correct |
23 |
Correct |
3 ms |
616 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
1 ms |
608 KB |
Correct |
3 |
Correct |
2 ms |
452 KB |
Correct |
4 |
Correct |
3 ms |
712 KB |
Correct |
5 |
Correct |
3 ms |
952 KB |
Correct |
6 |
Correct |
3 ms |
624 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
1 ms |
608 KB |
Correct |
3 |
Correct |
2 ms |
452 KB |
Correct |
4 |
Correct |
3 ms |
712 KB |
Correct |
5 |
Correct |
3 ms |
952 KB |
Correct |
6 |
Correct |
3 ms |
624 KB |
Correct |
7 |
Correct |
0 ms |
352 KB |
Correct |
8 |
Correct |
1 ms |
444 KB |
Correct |
9 |
Correct |
2 ms |
448 KB |
Correct |
10 |
Correct |
3 ms |
460 KB |
Correct |
11 |
Correct |
3 ms |
456 KB |
Correct |
12 |
Correct |
3 ms |
616 KB |
Correct |
13 |
Correct |
3 ms |
632 KB |
Correct |
14 |
Correct |
3 ms |
464 KB |
Correct |
15 |
Correct |
3 ms |
964 KB |
Correct |
16 |
Correct |
3 ms |
456 KB |
Correct |
17 |
Correct |
3 ms |
712 KB |
Correct |
18 |
Correct |
3 ms |
456 KB |
Correct |
19 |
Correct |
3 ms |
704 KB |
Correct |
20 |
Correct |
0 ms |
348 KB |
Correct |
21 |
Correct |
1 ms |
612 KB |
Correct |
22 |
Correct |
2 ms |
604 KB |
Correct |
23 |
Correct |
3 ms |
712 KB |
Correct |
24 |
Correct |
3 ms |
652 KB |
Correct |
25 |
Correct |
3 ms |
624 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
500 KB |
Correct |
2 |
Correct |
1 ms |
608 KB |
Correct |
3 |
Correct |
1 ms |
612 KB |
Correct |
4 |
Correct |
4 ms |
448 KB |
Correct |
5 |
Correct |
3 ms |
700 KB |
Correct |
6 |
Correct |
3 ms |
1092 KB |
Correct |
7 |
Correct |
3 ms |
640 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
500 KB |
Correct |
2 |
Correct |
1 ms |
608 KB |
Correct |
3 |
Correct |
1 ms |
612 KB |
Correct |
4 |
Correct |
4 ms |
448 KB |
Correct |
5 |
Correct |
3 ms |
700 KB |
Correct |
6 |
Correct |
3 ms |
1092 KB |
Correct |
7 |
Correct |
3 ms |
640 KB |
Correct |
8 |
Correct |
0 ms |
344 KB |
Correct |
9 |
Correct |
1 ms |
344 KB |
Correct |
10 |
Correct |
1 ms |
432 KB |
Correct |
11 |
Correct |
2 ms |
444 KB |
Correct |
12 |
Correct |
3 ms |
704 KB |
Correct |
13 |
Correct |
3 ms |
452 KB |
Correct |
14 |
Correct |
3 ms |
452 KB |
Correct |
15 |
Correct |
3 ms |
444 KB |
Correct |
16 |
Correct |
3 ms |
696 KB |
Correct |
17 |
Correct |
3 ms |
700 KB |
Correct |
18 |
Correct |
3 ms |
452 KB |
Correct |
19 |
Correct |
3 ms |
448 KB |
Correct |
20 |
Correct |
3 ms |
452 KB |
Correct |
21 |
Correct |
3 ms |
452 KB |
Correct |
22 |
Correct |
0 ms |
344 KB |
Correct |
23 |
Correct |
1 ms |
608 KB |
Correct |
24 |
Correct |
2 ms |
440 KB |
Correct |
25 |
Correct |
3 ms |
1208 KB |
Correct |
26 |
Correct |
3 ms |
456 KB |
Correct |
27 |
Correct |
3 ms |
800 KB |
Correct |
28 |
Correct |
3 ms |
408 KB |
Correct |