#include "swaps.h"
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "/home/ioi/contests/debug.h"
#else
#define debug(...) void(37)
#endif
void solve(int N, int V) {
vector<int> ord(N);
iota(ord.begin(), ord.end(), 1);
for (int i = 0; i < N; ++i) {
vector<array<int, 2>> qs;
for (int j = i % 2; j + 1 < N; j += 2) {
debug(j);
schedule(ord[j], ord[j + 1]);
qs.push_back({j, j + 1});
}
auto res = visit();
for (int i = 0; i < int(res.size()); ++i) {
if (!res[i]) {
swap(ord[qs[i][0]], ord[qs[i][1]]);
}
}
}
answer(ord);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Correct |
1 ms |
344 KB |
Correct |
3 |
Correct |
7 ms |
344 KB |
Correct |
4 |
Correct |
25 ms |
440 KB |
Correct |
5 |
Correct |
26 ms |
568 KB |
Correct |
6 |
Correct |
34 ms |
792 KB |
Correct |
7 |
Correct |
28 ms |
448 KB |
Correct |
8 |
Correct |
24 ms |
420 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
7 ms |
344 KB |
Correct |
4 |
Correct |
25 ms |
448 KB |
Correct |
5 |
Correct |
23 ms |
484 KB |
Correct |
6 |
Correct |
29 ms |
672 KB |
Correct |
7 |
Correct |
28 ms |
612 KB |
Correct |
8 |
Correct |
34 ms |
444 KB |
Correct |
9 |
Correct |
30 ms |
664 KB |
Correct |
10 |
Correct |
23 ms |
420 KB |
Correct |
11 |
Correct |
29 ms |
684 KB |
Correct |
12 |
Correct |
35 ms |
448 KB |
Correct |
13 |
Correct |
24 ms |
444 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 |
1 ms |
344 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
1 ms |
600 KB |
Correct |
3 |
Correct |
7 ms |
344 KB |
Correct |
4 |
Correct |
23 ms |
420 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
1 ms |
600 KB |
Correct |
3 |
Correct |
7 ms |
344 KB |
Correct |
4 |
Correct |
23 ms |
420 KB |
Correct |
5 |
Correct |
0 ms |
344 KB |
Correct |
6 |
Correct |
3 ms |
432 KB |
Correct |
7 |
Correct |
12 ms |
344 KB |
Correct |
8 |
Correct |
27 ms |
444 KB |
Correct |
9 |
Correct |
27 ms |
444 KB |
Correct |
10 |
Correct |
23 ms |
448 KB |
Correct |
11 |
Correct |
25 ms |
588 KB |
Correct |
12 |
Correct |
27 ms |
644 KB |
Correct |
13 |
Correct |
0 ms |
344 KB |
Correct |
14 |
Correct |
3 ms |
344 KB |
Correct |
15 |
Correct |
10 ms |
344 KB |
Correct |
16 |
Correct |
26 ms |
416 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
7 ms |
344 KB |
Correct |
4 |
Correct |
23 ms |
440 KB |
Correct |
5 |
Correct |
24 ms |
556 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
7 ms |
344 KB |
Correct |
4 |
Correct |
23 ms |
440 KB |
Correct |
5 |
Correct |
24 ms |
556 KB |
Correct |
6 |
Correct |
0 ms |
344 KB |
Correct |
7 |
Correct |
2 ms |
344 KB |
Correct |
8 |
Correct |
7 ms |
344 KB |
Correct |
9 |
Correct |
46 ms |
676 KB |
Correct |
10 |
Correct |
44 ms |
692 KB |
Correct |
11 |
Correct |
26 ms |
440 KB |
Correct |
12 |
Correct |
29 ms |
656 KB |
Correct |
13 |
Correct |
35 ms |
436 KB |
Correct |
14 |
Correct |
46 ms |
448 KB |
Correct |
15 |
Correct |
34 ms |
420 KB |
Correct |
16 |
Correct |
26 ms |
760 KB |
Correct |
17 |
Correct |
34 ms |
1172 KB |
Correct |
18 |
Correct |
25 ms |
436 KB |
Correct |
19 |
Correct |
0 ms |
340 KB |
Correct |
20 |
Correct |
2 ms |
344 KB |
Correct |
21 |
Correct |
9 ms |
344 KB |
Correct |
22 |
Correct |
27 ms |
436 KB |
Correct |
23 |
Correct |
26 ms |
416 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
1 ms |
436 KB |
Correct |
3 |
Correct |
7 ms |
344 KB |
Correct |
4 |
Correct |
25 ms |
440 KB |
Correct |
5 |
Correct |
26 ms |
440 KB |
Correct |
6 |
Runtime error |
6 ms |
616 KB |
Execution killed with signal 13 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
1 ms |
436 KB |
Correct |
3 |
Correct |
7 ms |
344 KB |
Correct |
4 |
Correct |
25 ms |
440 KB |
Correct |
5 |
Correct |
26 ms |
440 KB |
Correct |
6 |
Runtime error |
6 ms |
616 KB |
Execution killed with signal 13 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
1 ms |
344 KB |
Correct |
3 |
Correct |
9 ms |
344 KB |
Correct |
4 |
Correct |
25 ms |
448 KB |
Correct |
5 |
Correct |
27 ms |
596 KB |
Correct |
6 |
Runtime error |
10 ms |
420 KB |
Execution killed with signal 13 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
1 ms |
344 KB |
Correct |
3 |
Correct |
9 ms |
344 KB |
Correct |
4 |
Correct |
25 ms |
448 KB |
Correct |
5 |
Correct |
27 ms |
596 KB |
Correct |
6 |
Runtime error |
10 ms |
420 KB |
Execution killed with signal 13 |
7 |
Halted |
0 ms |
0 KB |
- |