답안 #151243

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151243 2019-09-02T09:56:04 Z jun6873 로카히아 유적 (FXCUP4_lokahia) C++17
0 / 100
3 ms 632 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;
        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);
        }
        if (nans.empty() and ans.size() % 2) nans.push_back(ans.back());
        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:15:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i=0; i+1<ans.size(); i+=2) {
                       ~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 632 KB Wrong
2 Partially correct 3 ms 632 KB Partially correct : C = 302
3 Correct 3 ms 632 KB Correct : C = 297
4 Correct 2 ms 504 KB Correct : C = 297
5 Correct 3 ms 632 KB Correct : C = 299
6 Correct 2 ms 632 KB Correct : C = 100
7 Correct 2 ms 504 KB Correct : C = 6
8 Partially correct 3 ms 632 KB Partially correct : C = 303
9 Correct 3 ms 532 KB Correct : C = 105
10 Correct 2 ms 380 KB Correct : C = 0
11 Correct 2 ms 504 KB Correct : C = 177
12 Correct 3 ms 504 KB Correct : C = 299
13 Correct 2 ms 504 KB Correct : C = 177
14 Correct 3 ms 504 KB Correct : C = 298
15 Correct 2 ms 524 KB Correct : C = 179
16 Correct 2 ms 632 KB Correct : C = 182
17 Correct 3 ms 632 KB Correct : C = 299
18 Incorrect 3 ms 632 KB Wrong
19 Partially correct 3 ms 504 KB Partially correct : C = 304
20 Correct 2 ms 632 KB Correct : C = 177
21 Correct 2 ms 504 KB Correct : C = 177
22 Incorrect 2 ms 504 KB Wrong
23 Correct 2 ms 632 KB Correct : C = 180
24 Partially correct 2 ms 632 KB Partially correct : C = 301
25 Correct 2 ms 500 KB Correct : C = 182
26 Correct 2 ms 504 KB Correct : C = 60
27 Correct 3 ms 632 KB Correct : C = 117