# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
149456 | 2019-09-01T06:31:46 Z | 20190901(#3597, tongnamuu, jf297, upple1) | On the Grid (FXCUP4_grid) | C++17 | 5 ms | 256 KB |
#include "grid.h" #define swap(a, b) (a^=b^=a^=b) std::vector<int> solve(std::vector<int> &a) { std::vector<int> ans(a.size()); for(int i=0; i<ans.size(); i++) { ans[a[i]]=i+1; } return ans; } std::vector<int> SortDisks(int N) { std::vector<int> res(N), a(N, -1); for(int i=0; i<N; i++) res[i]=i; for(int i=N-1; i>=0; i--) { for(int j=1; j<=i; j++) { int t=PutDisks(res); if(t==N) return solve(res); if(t-N==i) { a[res[0]]=i; swap(res[0], res[i]); break; } swap(res[0], res[j]); } } return solve(res); }
Compilation message
# | 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 | Incorrect | 5 ms | 256 KB | Output isn't correct |
4 | 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 | Incorrect | 5 ms | 256 KB | Output isn't correct |
4 | 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 | Incorrect | 5 ms | 256 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |