#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 < 8; 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;
tmp = test[i - tmp];
m[tmp]++;
}
int tmp = m.begin()->first, ma = -1;
for (auto& j : m)
if (j.second > ma) {
tmp = j.first;
ma = j.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 |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |