// #include <swaps.h>
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define pb push_back
#define all(x) x.begin(), x.end()
#define en cout << '\n'
void schedule(int, int);
vector<int> visit();
void answer(std::vector<int>);
vector<int> B;
void solve(int N, int V){
for(int i = 1; i <= N; ++i) B.pb(i);
for(int i = 0; i < 500; ++i){
if(i&1){
for(int j = 2; j < N; j += 2) schedule(B[j - 1], B[j]);
}else{
for(int j = 1; j < N; j += 2) schedule(B[j - 1], B[j]);
}
vector<int> vv = visit();
if(i&1){
for(int j = 2, k = 0; j < N; j += 2, ++k) if(!vv[k]) swap(B[j - 1], B[j]);
}else{
for(int j = 1, k = 0; j < N; j += 2, ++k) if(!vv[k]) swap(B[j - 1], B[j]);
}
}
answer(B);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Correct |
2 |
Correct |
8 ms |
344 KB |
Correct |
3 |
Correct |
17 ms |
344 KB |
Correct |
4 |
Correct |
33 ms |
1172 KB |
Correct |
5 |
Correct |
32 ms |
1168 KB |
Correct |
6 |
Correct |
32 ms |
436 KB |
Correct |
7 |
Correct |
46 ms |
944 KB |
Correct |
8 |
Correct |
32 ms |
1416 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Correct |
2 |
Correct |
8 ms |
344 KB |
Correct |
3 |
Correct |
17 ms |
344 KB |
Correct |
4 |
Correct |
33 ms |
664 KB |
Correct |
5 |
Correct |
33 ms |
1420 KB |
Correct |
6 |
Correct |
32 ms |
692 KB |
Correct |
7 |
Correct |
33 ms |
848 KB |
Correct |
8 |
Correct |
32 ms |
1168 KB |
Correct |
9 |
Correct |
33 ms |
1176 KB |
Correct |
10 |
Correct |
34 ms |
1164 KB |
Correct |
11 |
Correct |
34 ms |
1668 KB |
Correct |
12 |
Correct |
33 ms |
920 KB |
Correct |
13 |
Correct |
33 ms |
924 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Correct |
2 |
Correct |
8 ms |
344 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Correct |
2 |
Correct |
8 ms |
344 KB |
Correct |
3 |
Correct |
3 ms |
344 KB |
Correct |
4 |
Correct |
9 ms |
344 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Correct |
2 |
Correct |
8 ms |
344 KB |
Correct |
3 |
Correct |
17 ms |
344 KB |
Correct |
4 |
Correct |
33 ms |
1420 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Correct |
2 |
Correct |
8 ms |
344 KB |
Correct |
3 |
Correct |
17 ms |
344 KB |
Correct |
4 |
Correct |
33 ms |
1420 KB |
Correct |
5 |
Correct |
4 ms |
344 KB |
Correct |
6 |
Correct |
8 ms |
344 KB |
Correct |
7 |
Correct |
18 ms |
344 KB |
Correct |
8 |
Correct |
33 ms |
692 KB |
Correct |
9 |
Correct |
32 ms |
688 KB |
Correct |
10 |
Correct |
33 ms |
1168 KB |
Correct |
11 |
Correct |
33 ms |
920 KB |
Correct |
12 |
Correct |
34 ms |
1188 KB |
Correct |
13 |
Correct |
3 ms |
344 KB |
Correct |
14 |
Correct |
8 ms |
344 KB |
Correct |
15 |
Correct |
17 ms |
344 KB |
Correct |
16 |
Correct |
33 ms |
1668 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Correct |
2 |
Correct |
8 ms |
344 KB |
Correct |
3 |
Correct |
17 ms |
344 KB |
Correct |
4 |
Correct |
34 ms |
1176 KB |
Correct |
5 |
Correct |
32 ms |
1168 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Correct |
2 |
Correct |
8 ms |
344 KB |
Correct |
3 |
Correct |
17 ms |
344 KB |
Correct |
4 |
Correct |
34 ms |
1176 KB |
Correct |
5 |
Correct |
32 ms |
1168 KB |
Correct |
6 |
Correct |
3 ms |
344 KB |
Correct |
7 |
Correct |
8 ms |
344 KB |
Correct |
8 |
Correct |
18 ms |
340 KB |
Correct |
9 |
Correct |
37 ms |
1420 KB |
Correct |
10 |
Correct |
32 ms |
936 KB |
Correct |
11 |
Correct |
33 ms |
944 KB |
Correct |
12 |
Correct |
39 ms |
1412 KB |
Correct |
13 |
Correct |
33 ms |
940 KB |
Correct |
14 |
Correct |
33 ms |
1192 KB |
Correct |
15 |
Correct |
32 ms |
1164 KB |
Correct |
16 |
Correct |
33 ms |
920 KB |
Correct |
17 |
Correct |
32 ms |
664 KB |
Correct |
18 |
Correct |
33 ms |
1192 KB |
Correct |
19 |
Correct |
3 ms |
344 KB |
Correct |
20 |
Correct |
8 ms |
344 KB |
Correct |
21 |
Correct |
17 ms |
344 KB |
Correct |
22 |
Correct |
34 ms |
1172 KB |
Correct |
23 |
Correct |
33 ms |
696 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Correct |
2 |
Correct |
8 ms |
344 KB |
Correct |
3 |
Correct |
16 ms |
344 KB |
Correct |
4 |
Correct |
32 ms |
1180 KB |
Correct |
5 |
Correct |
35 ms |
1168 KB |
Correct |
6 |
Runtime error |
7 ms |
436 KB |
Execution killed with signal 13 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Correct |
2 |
Correct |
8 ms |
344 KB |
Correct |
3 |
Correct |
16 ms |
344 KB |
Correct |
4 |
Correct |
32 ms |
1180 KB |
Correct |
5 |
Correct |
35 ms |
1168 KB |
Correct |
6 |
Runtime error |
7 ms |
436 KB |
Execution killed with signal 13 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Correct |
2 |
Correct |
8 ms |
344 KB |
Correct |
3 |
Correct |
16 ms |
344 KB |
Correct |
4 |
Correct |
33 ms |
1172 KB |
Correct |
5 |
Correct |
32 ms |
692 KB |
Correct |
6 |
Runtime error |
7 ms |
664 KB |
Execution killed with signal 13 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Correct |
2 |
Correct |
8 ms |
344 KB |
Correct |
3 |
Correct |
16 ms |
344 KB |
Correct |
4 |
Correct |
33 ms |
1172 KB |
Correct |
5 |
Correct |
32 ms |
692 KB |
Correct |
6 |
Runtime error |
7 ms |
664 KB |
Execution killed with signal 13 |
7 |
Halted |
0 ms |
0 KB |
- |