#include "grid.h"
typedef std::vector<int> VI;
// ģ�� ���� �����
VI makeSeq(int N, int start, VI &found) {
VI v(N);
bool visit[250] = { 0, };
for (int i = 0; i < N; ++i) {
if (found[i]) {
int id = found[i] - 1; // "L - 1" means idx.
v[id] = i;
visit[i] = true;
}
}
for (int i = 0, count = 0; count < N; ++count) {
int num = (start + count) % N;
if (visit[num])
continue;
// �ش� ģ���� ���̰� �������ٸ�.
//if (found[num] > 0) {
// int id = found[num] - 1; // "L - 1" means idx.
// v[id] = num;
// continue;
//}
v[i] = num;
++i;
}
return v;
}
VI SortDisks(int N) {
VI found(N, 0);
int max_h = N + (N - 1);
for (int k = N - 1; k >= 0; --k) {
for (int i = 0; i < N; ++i) {
VI v = makeSeq(N, i, found);
int X = PutDisks(v);
if (X != max_h)
continue;
found[v[0]] = k + 1;
--max_h;
break;
}
}
return found;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
6 |
Correct |
7 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
6 |
Correct |
7 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
256 KB |
Output is correct |
9 |
Incorrect |
9 ms |
256 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
6 |
Correct |
7 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
6 ms |
256 KB |
Output is correct |
9 |
Incorrect |
9 ms |
256 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |