#include <bits/stdc++.h>
#include "swaps.h"
using namespace std;
typedef long long ll;
typedef double ld;
#define pb push_back
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
#define F first
#define S second
void solve(int n, int l) {
// TODO implement this function
vector<int> ret;
for (int i = 1; i <= n; i++) {
ret.pb(i);
}
for (int i = 0; i < min(n, l); i++) {
for (int j = (i & 1); j + 1 < n; j += 2) {
schedule(ret[j], ret[j+1]);
}
vector<int> v = visit();
for (int j = (i & 1), cur = 0; j + 1 < n; j += 2, cur++) {
if (!v[cur]) {
swap(ret[j], ret[j+1]);
}
}
}
answer(ret);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
9 ms |
344 KB |
Correct |
4 |
Correct |
31 ms |
680 KB |
Correct |
5 |
Correct |
34 ms |
1172 KB |
Correct |
6 |
Correct |
32 ms |
912 KB |
Correct |
7 |
Correct |
32 ms |
1428 KB |
Correct |
8 |
Correct |
37 ms |
916 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
10 ms |
344 KB |
Correct |
4 |
Correct |
31 ms |
440 KB |
Correct |
5 |
Correct |
32 ms |
920 KB |
Correct |
6 |
Correct |
31 ms |
696 KB |
Correct |
7 |
Correct |
33 ms |
1432 KB |
Correct |
8 |
Correct |
32 ms |
1192 KB |
Correct |
9 |
Correct |
32 ms |
1168 KB |
Correct |
10 |
Correct |
34 ms |
1180 KB |
Correct |
11 |
Correct |
31 ms |
944 KB |
Correct |
12 |
Correct |
32 ms |
920 KB |
Correct |
13 |
Correct |
31 ms |
928 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
0 ms |
344 KB |
Correct |
4 |
Correct |
3 ms |
344 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
8 ms |
344 KB |
Correct |
4 |
Correct |
31 ms |
924 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
8 ms |
344 KB |
Correct |
4 |
Correct |
31 ms |
924 KB |
Correct |
5 |
Correct |
0 ms |
344 KB |
Correct |
6 |
Correct |
2 ms |
344 KB |
Correct |
7 |
Correct |
8 ms |
344 KB |
Correct |
8 |
Correct |
34 ms |
1172 KB |
Correct |
9 |
Correct |
31 ms |
692 KB |
Correct |
10 |
Correct |
32 ms |
936 KB |
Correct |
11 |
Correct |
32 ms |
916 KB |
Correct |
12 |
Correct |
34 ms |
1172 KB |
Correct |
13 |
Correct |
1 ms |
344 KB |
Correct |
14 |
Correct |
2 ms |
600 KB |
Correct |
15 |
Correct |
9 ms |
344 KB |
Correct |
16 |
Correct |
33 ms |
932 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
10 ms |
344 KB |
Correct |
4 |
Correct |
35 ms |
1424 KB |
Correct |
5 |
Correct |
33 ms |
1428 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
10 ms |
344 KB |
Correct |
4 |
Correct |
35 ms |
1424 KB |
Correct |
5 |
Correct |
33 ms |
1428 KB |
Correct |
6 |
Correct |
0 ms |
344 KB |
Correct |
7 |
Correct |
2 ms |
344 KB |
Correct |
8 |
Correct |
9 ms |
344 KB |
Correct |
9 |
Correct |
37 ms |
940 KB |
Correct |
10 |
Correct |
32 ms |
1168 KB |
Correct |
11 |
Correct |
33 ms |
1192 KB |
Correct |
12 |
Correct |
32 ms |
856 KB |
Correct |
13 |
Correct |
39 ms |
924 KB |
Correct |
14 |
Correct |
34 ms |
916 KB |
Correct |
15 |
Correct |
32 ms |
940 KB |
Correct |
16 |
Correct |
31 ms |
1172 KB |
Correct |
17 |
Correct |
33 ms |
1432 KB |
Correct |
18 |
Correct |
35 ms |
1680 KB |
Correct |
19 |
Correct |
0 ms |
344 KB |
Correct |
20 |
Correct |
2 ms |
600 KB |
Correct |
21 |
Correct |
9 ms |
344 KB |
Correct |
22 |
Correct |
32 ms |
1172 KB |
Correct |
23 |
Correct |
38 ms |
944 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
8 ms |
344 KB |
Correct |
4 |
Correct |
33 ms |
920 KB |
Correct |
5 |
Correct |
31 ms |
692 KB |
Correct |
6 |
Incorrect |
7 ms |
1164 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
8 ms |
344 KB |
Correct |
4 |
Correct |
33 ms |
920 KB |
Correct |
5 |
Correct |
31 ms |
692 KB |
Correct |
6 |
Incorrect |
7 ms |
1164 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
10 ms |
344 KB |
Correct |
4 |
Correct |
33 ms |
1176 KB |
Correct |
5 |
Correct |
31 ms |
1168 KB |
Correct |
6 |
Incorrect |
7 ms |
604 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
10 ms |
344 KB |
Correct |
4 |
Correct |
33 ms |
1176 KB |
Correct |
5 |
Correct |
31 ms |
1168 KB |
Correct |
6 |
Incorrect |
7 ms |
604 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |