#include "lokahia.h"
int p[202];
int a[202];
int FindBase(int N){
int i, j, k, t;
for (i = 0; i < N; i++) {
p[i] = 1;
a[i] = i;
}
for (i = j = k = 0; i < N; i++) {
if (k) {
t = CollectRelics(a[j], a[i]);
if (t == -1) k--;
else {
p[i] = 0;
p[j]++;
a[j] = t;
k++;
}
}
else {
j = i;
k = 1;
}
}
if (!k) return -1;
for (i = 0; i < j; i++) if (p[i]) {
t = CollectRelics(a[j], a[i]);
if (t != -1) {
a[j] = t;
p[j] += p[i];
}
}
if (p[j] * 2 > N) return a[j];
return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
512 KB |
Wrong |
2 |
Incorrect |
6 ms |
512 KB |
Wrong |
3 |
Correct |
5 ms |
512 KB |
Correct : C = 177 |
4 |
Incorrect |
5 ms |
512 KB |
Wrong |
5 |
Incorrect |
6 ms |
640 KB |
Wrong |
6 |
Incorrect |
6 ms |
512 KB |
Wrong |
7 |
Incorrect |
6 ms |
512 KB |
Wrong |
8 |
Incorrect |
5 ms |
512 KB |
Wrong |
9 |
Incorrect |
6 ms |
640 KB |
Wrong |
10 |
Correct |
6 ms |
640 KB |
Correct : C = 111 |
11 |
Correct |
6 ms |
640 KB |
Correct : C = 297 |
12 |
Incorrect |
6 ms |
640 KB |
Wrong |
13 |
Incorrect |
7 ms |
640 KB |
Wrong |
14 |
Incorrect |
6 ms |
640 KB |
Wrong |
15 |
Incorrect |
6 ms |
640 KB |
Wrong |
16 |
Correct |
5 ms |
512 KB |
Correct : C = 4 |
17 |
Incorrect |
7 ms |
640 KB |
Wrong |
18 |
Incorrect |
7 ms |
640 KB |
Wrong |
19 |
Incorrect |
6 ms |
640 KB |
Wrong |
20 |
Incorrect |
6 ms |
640 KB |
Wrong |
21 |
Incorrect |
6 ms |
640 KB |
Wrong |
22 |
Incorrect |
5 ms |
560 KB |
Wrong |
23 |
Correct |
5 ms |
512 KB |
Correct : C = 0 |
24 |
Incorrect |
5 ms |
512 KB |
Wrong |
25 |
Correct |
6 ms |
640 KB |
Correct : C = 100 |
26 |
Correct |
5 ms |
512 KB |
Correct : C = 60 |
27 |
Incorrect |
6 ms |
640 KB |
Wrong |