Submission #149474

#TimeUsernameProblemLanguageResultExecution timeMemory
149474Cafe Maru (#200)On the Grid (FXCUP4_grid)C++17
12 / 100
6 ms432 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...