#include "swaps.h"
#include <bits/stdc++.h>
using namespace std;
int C[550];
bool chk1[550], chk2[550];
void solve(int N, int V){
vector<int> ans(N);
for (int i=1; i<N; i++){
memset(chk1, 0, sizeof chk1);
memset(chk2, 0, sizeof chk2);
for (int j=0; j<N; j++){
if (!chk2[j] && !chk2[(j+i)%N]){
chk1[j] = true;
chk2[j] = chk2[(j+i)%N] = true;
schedule(j+1, (j+i)%N+1);
}
}
vector<int> v = visit();
for (int i=N-1; i>=0; i--) if (chk1[i]) C[i+1] += v.back(), v.pop_back();
for (int j=0; j<N; j++) if (!chk1[j]) schedule(j+1, (j+i)%N+1);
v = visit();
for (int i=N-1; i>=0; i--) if (!chk1[i]) C[i+1] += v.back(), v.pop_back();
}
for (int i=1; i<=N; i++) ans[C[i]] = i;
reverse(ans.begin(), ans.end());
answer(ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |