#include "lokahia.h"
int FindBase(int N){
int who = 0;
int cnt = 0;
for(int i=0; i<N; i++){
if(cnt == 0){
who = i;
cnt = 1;
continue;
}
int query = CollectRelics(who, i);
if(query == -1) cnt--;
else{
who = query;
cnt++;
}
}
cnt = 0;
for(int i=0; i<N; i++){
int cr = (who == i ? who : CollectRelics(who, i));
if(cr != -1){
who = cr;
cnt++;
}
}
if(cnt >= N / 2 + 1) return who;
return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
636 KB |
Wrong |
2 |
Correct |
2 ms |
504 KB |
Correct : C = 225 |
3 |
Partially correct |
3 ms |
632 KB |
Partially correct : C = 385 |
4 |
Incorrect |
2 ms |
504 KB |
Wrong |
5 |
Incorrect |
3 ms |
632 KB |
Wrong |
6 |
Correct |
2 ms |
632 KB |
Correct : C = 297 |
7 |
Correct |
2 ms |
504 KB |
Correct : C = 0 |
8 |
Correct |
2 ms |
632 KB |
Correct : C = 228 |
9 |
Incorrect |
2 ms |
632 KB |
Wrong |
10 |
Incorrect |
3 ms |
632 KB |
Wrong |
11 |
Correct |
2 ms |
632 KB |
Correct : C = 299 |
12 |
Incorrect |
2 ms |
504 KB |
Wrong |
13 |
Incorrect |
2 ms |
504 KB |
Wrong |
14 |
Partially correct |
2 ms |
504 KB |
Partially correct : C = 385 |
15 |
Incorrect |
2 ms |
632 KB |
Wrong |
16 |
Correct |
2 ms |
504 KB |
Correct : C = 177 |
17 |
Incorrect |
2 ms |
632 KB |
Wrong |
18 |
Correct |
2 ms |
376 KB |
Correct : C = 8 |
19 |
Incorrect |
2 ms |
504 KB |
Wrong |
20 |
Incorrect |
3 ms |
504 KB |
Wrong |
21 |
Incorrect |
2 ms |
552 KB |
Wrong |
22 |
Partially correct |
2 ms |
632 KB |
Partially correct : C = 317 |
23 |
Incorrect |
2 ms |
504 KB |
Wrong |
24 |
Incorrect |
2 ms |
504 KB |
Wrong |
25 |
Correct |
2 ms |
504 KB |
Correct : C = 179 |
26 |
Incorrect |
2 ms |
504 KB |
Wrong |
27 |
Partially correct |
3 ms |
504 KB |
Partially correct : C = 310 |