#include <bits/stdc++.h>
#include "grid.h"
using namespace std;
int inqu[1005];
int done[1005];
int hm[1005];
vector<int> ret;
vector<int> ans;
vector<int> qu;
vector<int> SortDisks(int N) {
for (int i = N; i >= 1; i--){
for (int j = 0; j < N; j++){
if (done[j]) continue;
//printf("testing if L[%d] = %d\n",j,i);
qu.clear();
for (int i = 0; i < N; i++){
inqu[i] = 0;
}
for (auto x : ans) {
inqu[x] = 1;
qu.push_back(x);
}
for (int k = 0; k < N; k++){
if (inqu[k] || k == j) continue;
qu.push_back(k);
inqu[k] = 1;
}
qu.push_back(j);
inqu[j] = 1;
reverse(qu.begin(),qu.end());
if (PutDisks(qu) == N+i-1){
//printf("Found L[%d] = %d\n",j,i);
ans.push_back(j);
hm[j] = i;
done[j] = 1;
break;
}
}
}
for (int i = 0; i < N; i++){
ret.push_back(hm[i]);
}
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |