답안 #248228

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
248228 2020-07-12T08:43:05 Z lyc 로카히아 유적 (FXCUP4_lokahia) C++17
0 / 100
2 ms 640 KB
#include "lokahia.h"
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)

int FindBase(int N){
    int x = 0, y = 1, z;
    FOR(i,1,N-1){
        if (y == 0) x = i, y = 1;
        else if (x == i || (z = CollectRelics(x,i)) != -1) x = z, ++y;
        else --y;
    }
    int c = 1;
    FOR(i,0,N-1) if (x != i) {
        if (CollectRelics(x,i) != -1) ++c;
    }
	return (c > N/2 ? x : -1);
}

Compilation message

lokahia.cpp: In function 'int FindBase(int)':
lokahia.cpp:16:18: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
     FOR(i,0,N-1) if (x != i) {
                  ^~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 640 KB Partially correct : C = 397
2 Partially correct 1 ms 640 KB Partially correct : C = 388
3 Correct 1 ms 640 KB Correct : C = 297
4 Incorrect 1 ms 640 KB Wrong
5 Correct 2 ms 512 KB Correct : C = 235
6 Partially correct 1 ms 640 KB Partially correct : C = 395
7 Incorrect 1 ms 640 KB Wrong
8 Correct 1 ms 512 KB Correct : C = 237
9 Correct 2 ms 512 KB Correct : C = 225
10 Correct 0 ms 512 KB Correct : C = 0
11 Correct 1 ms 640 KB Correct : C = 223
12 Partially correct 1 ms 640 KB Partially correct : C = 310
13 Partially correct 1 ms 640 KB Partially correct : C = 385
14 Correct 1 ms 512 KB Correct : C = 177
15 Correct 1 ms 512 KB Correct : C = 235
16 Correct 1 ms 640 KB Correct : C = 299
17 Correct 2 ms 512 KB Correct : C = 228
18 Partially correct 2 ms 640 KB Partially correct : C = 384
19 Partially correct 1 ms 640 KB Partially correct : C = 388
20 Correct 1 ms 512 KB Correct : C = 179
21 Partially correct 1 ms 640 KB Partially correct : C = 317
22 Correct 1 ms 512 KB Correct : C = 8
23 Incorrect 1 ms 512 KB Wrong
24 Partially correct 1 ms 640 KB Partially correct : C = 385
25 Partially correct 1 ms 640 KB Partially correct : C = 383
26 Partially correct 2 ms 640 KB Partially correct : C = 379
27 Correct 1 ms 512 KB Correct : C = 228