#include "grid.h"
int candi[1005][1005];
std::vector<int> SortDisks(int N) {
std::vector<int> disks; // i번째로 넣을 막대,(막대 번호)
std::vector<int> ans; // i번째 막대의 길이, a[i] = N
// int result;
disks.resize(N);
ans.resize(N);
int maxV = 2 * N - 1;
int mod = N;
for (int i = 0; i <= N; i++) {
for (int j = 0; j <= N; j++) {
candi[i][j] = 1;
}
}
for (int i = 0; i < N; i++) {
disks[i] = i;
}
for (int i = 0; i < 2 * N; i++) {
int result = PutDisks(disks);
if (result == N) {
for (int j = 0; j < N; j++) {
ans[disks[j]] = j + 1;
}
break;
}
if (result == maxV) {
ans[disks[0]] = mod;
int temp = disks[0];
disks[0] = disks[mod - 1];
disks[mod - 1] = temp;
mod--;
maxV--;
}
// for(int j = 0; j < N; j++ ) {
// for(int l = N - diff - j - 1; l >=0; l--) {
// candi[disks[l]][N-j] = 0;
// }
// }
int temp = disks[0];
for (int j = 0; j < mod-1; j++) {
disks[j] = disks[j + 1];
}
disks[mod - 1] = temp;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |