#include "grid.h"
std::vector<int> SortDisks(int N) {
if (N > 50) return std::vector<int>();
std::vector<int> rem(N);
for (int ni = 0; ni < N; ni++) {
rem[ni] = ni;
}
std::vector<int> p(N);
for (int ni = N; ni > 0; ni--) {
for (int nj = 0; nj < ni; nj++) {
for (int nk = 0; nk < ni; nk++) {
p[nk] = rem[(nj + nk) % ni];
}
for (int nk = 0; nk < N; nk++) {
}
int r = PutDisks(p);
if (r == N + ni - 1) {
p[ni - 1] = rem[nj];
std::swap(rem[ni - 1], rem[nj]);
break;
}
}
}
std::vector<int> answer(N);
for (int ni = 0; ni < N; ni++) {
answer[p[ni]] = ni + 1;
}
return answer;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
432 KB |
Output is correct |
4 |
Correct |
6 ms |
256 KB |
Output is correct |
5 |
Correct |
6 ms |
256 KB |
Output is correct |
6 |
Correct |
6 ms |
256 KB |
Output is correct |
7 |
Correct |
6 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
432 KB |
Output is correct |
4 |
Correct |
6 ms |
256 KB |
Output is correct |
5 |
Correct |
6 ms |
256 KB |
Output is correct |
6 |
Correct |
6 ms |
256 KB |
Output is correct |
7 |
Correct |
6 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
304 KB |
Output is correct |
9 |
Incorrect |
6 ms |
256 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
432 KB |
Output is correct |
4 |
Correct |
6 ms |
256 KB |
Output is correct |
5 |
Correct |
6 ms |
256 KB |
Output is correct |
6 |
Correct |
6 ms |
256 KB |
Output is correct |
7 |
Correct |
6 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
304 KB |
Output is correct |
9 |
Incorrect |
6 ms |
256 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |