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 "grid.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> SortDisks(int N) {
vector<int> ans(N), ord(N), check(N, -1);
for (int i = 0; i < N; i++) ord[i] = i;
int prev = PutDisks(ord), curr;
while (!ord.empty()){
int firstin = ord.back();
for (int i = ord.size() - 1; i > 0; i--) ord[i] = ord[i - 1];
ord[0] = firstin;
vector<int> test(N);
int ind = 0;
for (int i = 0; i < N; i++){
if (check[i] != -1) test[i] = check[i];
else test[i] = ord[ind++];
}
curr = PutDisks(test);
if (curr >= prev){
ans[firstin] = curr - N + 1;
check[ans[firstin] - 1] = firstin;
ord.erase(ord.begin());
}
else prev = curr;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |