#include "grid.h"
#include <algorithm>
using namespace std;
std::vector<int> SortDisks(int N) {
vector<int> W,Z,T(N);
for(int i=0;i<N;i++)W.push_back(i);
for(int i=0;i<N;i++){
pair<int,int> ans={-1,-1};
for(int j=0;j<(int)W.size();j++){
vector<int> V;
for(int k=0;k<(int)W.size();k++){
V.push_back(W[(j+k)%W.size()]);
}
for(auto &x:Z)V.push_back(x);
ans=max(ans,make_pair(PutDisks(V),j));
}
int j=ans.second;
Z.push_back(W[j]);
W.erase(W.begin()+j,W.begin()+j+1);
}
reverse(Z.begin(),Z.end());
for(int i=0;i<N;i++)T[Z[i]]=i+1;
return T;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
256 KB |
Output is correct |
2 |
Incorrect |
6 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
256 KB |
Output is correct |
2 |
Incorrect |
6 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
3 |
Correct |
6 ms |
256 KB |
Output is correct |