#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(int i=Z.size();i--;)V.push_back(Z[i]);
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
6 ms |
256 KB |
Output is correct |
4 |
Correct |
7 ms |
256 KB |
Output is correct |
5 |
Correct |
7 ms |
256 KB |
Output is correct |
6 |
Correct |
8 ms |
256 KB |
Output is correct |
7 |
Correct |
6 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
6 ms |
256 KB |
Output is correct |
4 |
Correct |
7 ms |
256 KB |
Output is correct |
5 |
Correct |
7 ms |
256 KB |
Output is correct |
6 |
Correct |
8 ms |
256 KB |
Output is correct |
7 |
Correct |
6 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
256 KB |
Output is correct |
9 |
Incorrect |
9 ms |
256 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
6 ms |
256 KB |
Output is correct |
4 |
Correct |
7 ms |
256 KB |
Output is correct |
5 |
Correct |
7 ms |
256 KB |
Output is correct |
6 |
Correct |
8 ms |
256 KB |
Output is correct |
7 |
Correct |
6 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
256 KB |
Output is correct |
9 |
Incorrect |
9 ms |
256 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |