#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 = (who == i ? who : 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 |
Correct |
2 ms |
504 KB |
Correct : C = 234 |
2 |
Correct |
2 ms |
632 KB |
Correct : C = 225 |
3 |
Correct |
2 ms |
632 KB |
Correct : C = 223 |
4 |
Partially correct |
2 ms |
632 KB |
Partially correct : C = 385 |
5 |
Partially correct |
3 ms |
632 KB |
Partially correct : C = 388 |
6 |
Correct |
2 ms |
632 KB |
Correct : C = 235 |
7 |
Partially correct |
3 ms |
504 KB |
Partially correct : C = 310 |
8 |
Correct |
2 ms |
376 KB |
Correct : C = 0 |
9 |
Partially correct |
3 ms |
504 KB |
Partially correct : C = 379 |
10 |
Correct |
2 ms |
632 KB |
Correct : C = 228 |
11 |
Correct |
2 ms |
504 KB |
Correct : C = 8 |
12 |
Partially correct |
3 ms |
504 KB |
Partially correct : C = 397 |
13 |
Partially correct |
3 ms |
504 KB |
Partially correct : C = 383 |
14 |
Correct |
2 ms |
504 KB |
Correct : C = 237 |
15 |
Correct |
2 ms |
552 KB |
Correct : C = 228 |
16 |
Partially correct |
2 ms |
632 KB |
Partially correct : C = 395 |
17 |
Correct |
2 ms |
632 KB |
Correct : C = 235 |
18 |
Partially correct |
2 ms |
632 KB |
Partially correct : C = 388 |
19 |
Correct |
2 ms |
632 KB |
Correct : C = 177 |
20 |
Correct |
2 ms |
632 KB |
Correct : C = 299 |
21 |
Correct |
2 ms |
632 KB |
Correct : C = 179 |
22 |
Partially correct |
3 ms |
504 KB |
Partially correct : C = 317 |
23 |
Partially correct |
3 ms |
632 KB |
Partially correct : C = 384 |
24 |
Correct |
3 ms |
504 KB |
Correct : C = 297 |
25 |
Partially correct |
2 ms |
504 KB |
Partially correct : C = 397 |
26 |
Partially correct |
3 ms |
504 KB |
Partially correct : C = 395 |
27 |
Partially correct |
3 ms |
504 KB |
Partially correct : C = 385 |