#include <bits/stdc++.h>
using namespace std;
#include "grid.h"
vector<int> SortDisks(int N) {
srand(689);
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--) {
map<int, int> m;
for (int k = 0; k < 10; k++) {
vector<int> vv(left.begin(), left.end());
random_shuffle(vv.begin(), vv.end());
vector<int> test(inv);
for (int j = 0; j <= i; j++)
test[j] = vv[j];
// for (int j : test) printf("%d ", j); puts("");
int tmp = PutDisks(test) - N;
m[tmp] = test[i - tmp];
}
int tmp = m.begin()->second;
// printf("i=%d tmp=%d\n", i, tmp);
left.erase(tmp);
ans[tmp] = i + 1;
inv[i] = tmp;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
256 KB |
Output is correct |
3 |
Incorrect |
6 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
256 KB |
Output is correct |
3 |
Incorrect |
6 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Incorrect |
6 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
4 |
Correct |
6 ms |
256 KB |
Output is correct |