답안 #151240

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151240 2019-09-02T09:45:32 Z jun6873 로카히아 유적 (FXCUP4_lokahia) C++17
0 / 100
3 ms 636 KB
#include "lokahia.h"
#include <bits/stdc++.h>
using namespace std;

int FindBase(int N) {
    srand(20001021);

    vector<int> ans;

    for (int i=0; i<N; i++) ans.push_back(i);

    int k;
    while (ans.size() > 1) {
        vector<int> nans;
        if (ans.size() % 2) nans.push_back(ans.back());
        for (int i=0; i+1<ans.size(); i+=2) {
            if (ans[i] == ans[i+1]) nans.push_back(ans[i]);
            else if ((k = CollectRelics(ans[i], ans[i+1])) != -1) nans.push_back(k);
        }
        ans = nans;
    }

    if (ans.empty()) return -1;

    int cand = ans[0];

    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;
}

Compilation message

lokahia.cpp: In function 'int FindBase(int)':
lokahia.cpp:16:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i=0; i+1<ans.size(); i+=2) {
                       ~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 632 KB Correct : C = 117
2 Incorrect 3 ms 504 KB Wrong
3 Correct 2 ms 504 KB Correct : C = 177
4 Correct 3 ms 504 KB Correct : C = 298
5 Correct 2 ms 632 KB Correct : C = 180
6 Correct 2 ms 504 KB Correct : C = 60
7 Incorrect 3 ms 504 KB Wrong
8 Correct 2 ms 632 KB Correct : C = 178
9 Correct 2 ms 504 KB Correct : C = 182
10 Correct 3 ms 632 KB Correct : C = 297
11 Incorrect 3 ms 504 KB Wrong
12 Correct 2 ms 504 KB Correct : C = 178
13 Correct 3 ms 632 KB Correct : C = 105
14 Partially correct 3 ms 632 KB Partially correct : C = 304
15 Correct 2 ms 504 KB Correct : C = 182
16 Correct 2 ms 632 KB Correct : C = 100
17 Partially correct 3 ms 636 KB Partially correct : C = 304
18 Correct 3 ms 552 KB Correct : C = 299
19 Correct 2 ms 504 KB Correct : C = 299
20 Correct 3 ms 504 KB Correct : C = 105
21 Correct 3 ms 632 KB Correct : C = 178
22 Correct 2 ms 376 KB Correct : C = 7
23 Correct 3 ms 632 KB Correct : C = 299
24 Partially correct 3 ms 632 KB Partially correct : C = 302
25 Correct 2 ms 632 KB Correct : C = 179
26 Correct 2 ms 376 KB Correct : C = 0
27 Correct 3 ms 632 KB Correct : C = 299