This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |