#include <bits/stdc++.h>
#include "swaps.h"
using namespace std;
vector<int> dcS(vector<int> A) {
bool ok = false;
int N = A.size();
while(ok == false) {
ok = true;
for(int l = 0; l + 1 < N; l += 2)
schedule(A[l], A[l + 1]);
vector<int> K = visit();
for(int l = 0, cur = 0; l + 1 < N; l += 2, cur++) {
if(K[cur] == 0) {
ok = false;
swap(A[l], A[l + 1]);
}
}
for(int l = 1; l + 1 < N; l += 2)
schedule(A[l], A[l + 1]);
K.clear(); K = visit();
for(int l = 1, cur = 0; l + 1 < N; l += 2, cur++) {
if(K[cur] == 0) {
ok = false;
swap(A[l], A[l + 1]);
}
}
}
return A;
}
void solve(int N, int V) {
vector<int> res(N);
for(int l = 0; l < N; l++)
res[l] = l + 1;
res = dcS(res);
answer(res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
2 ms |
344 KB |
Correct |
3 |
Correct |
6 ms |
344 KB |
Correct |
4 |
Correct |
24 ms |
956 KB |
Correct |
5 |
Correct |
0 ms |
344 KB |
Correct |
6 |
Correct |
23 ms |
412 KB |
Correct |
7 |
Correct |
41 ms |
572 KB |
Correct |
8 |
Correct |
24 ms |
576 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Correct |
3 ms |
344 KB |
Correct |
3 |
Correct |
6 ms |
344 KB |
Correct |
4 |
Correct |
23 ms |
440 KB |
Correct |
5 |
Correct |
0 ms |
344 KB |
Correct |
6 |
Correct |
25 ms |
440 KB |
Correct |
7 |
Correct |
38 ms |
532 KB |
Correct |
8 |
Correct |
27 ms |
672 KB |
Correct |
9 |
Correct |
24 ms |
608 KB |
Correct |
10 |
Correct |
1 ms |
344 KB |
Correct |
11 |
Correct |
23 ms |
416 KB |
Correct |
12 |
Correct |
24 ms |
436 KB |
Correct |
13 |
Correct |
46 ms |
416 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |