#include <bits/stdc++.h>
using namespace std;
#include "grid.h"
vector<int> SortDisks(int N) {
vector<int> ans(N), inv(N);
set<int> left;
for (int i = 0; i < N; i++)
left.insert(i);
for (int i = N - 1; i >= 0; i--) {
vector<int> test(inv);
auto it = left.begin();
for (int j = 0; j <= i; j++, it++)
test[j] = *it;
// for (int j : test) printf("%d ", j); puts("");
int tmp = PutDisks(test) - N;
tmp = test[i - tmp];
// printf("i=%d tmp=%d\n", i, tmp);
left.erase(tmp);
ans[tmp] = i + 1;
inv[i] = tmp;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
316 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
316 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Halted |
0 ms |
0 KB |
- |
3 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
4 |
Correct |
5 ms |
316 KB |
Output is correct |