#include "grid.h"
#include<bits/stdc++.h>
using namespace std;
int n;
vector<int> SortDisks(int N) {
n = N;
if (N>50) return vector<int>(n,0);
vector<int> que(n,0), ans(n,0);
for (int i=0;i<n;i++) {
int p = 0, t = 0;
for (int j=0;j<n;j++) {
if (ans[j]) continue;
int q = 0;
for (int k=0;k<n;k++) {
if (ans[k]) continue;
que[k]=(q-p+n-i)%(n-i)+1;
q++;
}
vector<int> rq(n,0);
for (int k=0;k<n;k++) {
rq[que[k]-1] = k;
}
p++;
int m = PutDisks(rq);
if (m-n==n-i-1) {
t = j;
}
}
ans[t] = que[t] = n-i;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
296 KB |
Output is correct |
6 |
Correct |
3 ms |
244 KB |
Output is correct |
7 |
Correct |
3 ms |
376 KB |
Output is correct |
8 |
Correct |
3 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
296 KB |
Output is correct |
6 |
Correct |
3 ms |
244 KB |
Output is correct |
7 |
Correct |
3 ms |
376 KB |
Output is correct |
8 |
Correct |
3 ms |
376 KB |
Output is correct |
9 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
296 KB |
Output is correct |
6 |
Correct |
3 ms |
244 KB |
Output is correct |
7 |
Correct |
3 ms |
376 KB |
Output is correct |
8 |
Correct |
3 ms |
376 KB |
Output is correct |
9 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |