#include "grid.h"
std::vector<int> SortDisks(int N) {
std::vector<int> ans(N), temp(N);
for(int i=0;i<N;i++) ans[i]=i;
for(int i=N-1;i>=0;i--) {
int X=PutDisks(ans)-N, Y;
if(X==0) break;
else if(X==i) {
std::swap(ans[0],ans[i]);
continue;
}
std::swap(ans[0],ans[i-X]);
Y=PutDisks(ans)-N;
if(Y==0) break;
else if(Y==i) {
std::swap(ans[0],ans[i]);
continue;
}
++i;
for(int j=0;j<i;j++) temp[(j+X)%i]=ans[j];
for(int j=0;j<i;j++) ans[j]=temp[j];
}
for(int i=0;i<N;i++) temp[ans[i]]=i+1;
return temp;
}
# |
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 |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
7 |
Correct |
5 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 |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
304 KB |
Output is correct |
9 |
Correct |
6 ms |
256 KB |
Output is correct |
10 |
Incorrect |
9 ms |
464 KB |
Output isn't correct |
11 |
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 |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
304 KB |
Output is correct |
9 |
Correct |
6 ms |
256 KB |
Output is correct |
10 |
Incorrect |
9 ms |
464 KB |
Output isn't correct |
11 |
Halted |
0 ms |
0 KB |
- |