#include "lokahia.h"
int FindBase(int N) {
if (N == 1) return 0;
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 = 0 |
2 |
Correct |
6 ms |
512 KB |
Correct : C = 6 |
3 |
Correct |
6 ms |
512 KB |
Correct : C = 177 |
4 |
Correct |
6 ms |
640 KB |
Correct : C = 299 |
5 |
Correct |
7 ms |
640 KB |
Correct : C = 297 |
6 |
Correct |
6 ms |
592 KB |
Correct : C = 179 |
7 |
Correct |
6 ms |
512 KB |
Correct : C = 177 |
8 |
Correct |
7 ms |
640 KB |
Correct : C = 299 |
9 |
Correct |
6 ms |
512 KB |
Correct : C = 177 |
10 |
Correct |
7 ms |
640 KB |
Correct : C = 299 |
11 |
Correct |
6 ms |
640 KB |
Correct : C = 297 |
12 |
Correct |
7 ms |
600 KB |
Correct : C = 299 |
13 |
Correct |
6 ms |
472 KB |
Correct : C = 177 |
14 |
Correct |
7 ms |
640 KB |
Correct : C = 179 |
15 |
Correct |
6 ms |
640 KB |
Correct : C = 297 |
16 |
Correct |
6 ms |
512 KB |
Correct : C = 60 |
17 |
Correct |
7 ms |
640 KB |
Correct : C = 299 |
18 |
Correct |
6 ms |
640 KB |
Correct : C = 299 |
19 |
Correct |
7 ms |
640 KB |
Correct : C = 299 |
20 |
Correct |
6 ms |
640 KB |
Correct : C = 297 |
21 |
Incorrect |
6 ms |
600 KB |
Wrong |
22 |
Correct |
8 ms |
600 KB |
Correct : C = 100 |
23 |
Correct |
6 ms |
512 KB |
Correct : C = 179 |
24 |
Correct |
6 ms |
512 KB |
Correct : C = 177 |
25 |
Correct |
6 ms |
640 KB |
Correct : C = 297 |
26 |
Correct |
7 ms |
512 KB |
Correct : C = 179 |
27 |
Correct |
6 ms |
640 KB |
Correct : C = 297 |