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