답안 #247285

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
247285 2020-07-11T08:36:14 Z dantoh000 로카히아 유적 (FXCUP4_lokahia) C++17
0 / 100
6 ms 768 KB
#include <bits/stdc++.h>
using namespace std;
#include "lokahia.h"
int Q[205][205];
int tq = 0;
int query(int i, int j){
    if (i == j) return Q[i][i] = i;
    else if (Q[i][j] == -2) {
        tq++;
        return Q[i][j] = Q[j][i] = CollectRelics(i,j);
    }
    else return Q[i][j];
}
int FindBase(int N){
    for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) Q[i][j] = -2;
    vector<int> good;
    for (int i = 0; i < N; i++) good.push_back(i);
    while (good.size() && tq <= 600){
        int cur = good[0];
        for (auto x : good){
            if (cur == x) continue;
            int q = query(cur,x);
            if (q != -1 && q > cur) cur = q;
        }
        int ct = 0;
        vector<int> bad;
        for (auto x : good){
            if (x == cur || query(x,cur) != -1) ct++;
            else bad.push_back(x);
            if (ct > N/2) break;
        }
        if (ct > N/2) return cur;
        swap(good,bad);
        bad.clear();
    }
    return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 640 KB Wrong
2 Incorrect 6 ms 768 KB Wrong
3 Correct 5 ms 768 KB Correct : C = 200
4 Incorrect 6 ms 768 KB Wrong
5 Correct 5 ms 768 KB Correct : C = 199
6 Correct 5 ms 640 KB Correct : C = 121
7 Correct 6 ms 768 KB Correct : C = 300
8 Correct 5 ms 512 KB Correct : C = 0
9 Incorrect 5 ms 768 KB Wrong
10 Correct 5 ms 768 KB Correct : C = 120
11 Correct 6 ms 640 KB Correct : C = 120
12 Correct 5 ms 768 KB Correct : C = 199
13 Incorrect 5 ms 768 KB Wrong
14 Partially correct 6 ms 640 KB Partially correct : C = 430
15 Correct 5 ms 640 KB Correct : C = 119
16 Partially correct 6 ms 768 KB Partially correct : C = 368
17 Correct 5 ms 768 KB Correct : C = 200
18 Incorrect 5 ms 768 KB Wrong
19 Correct 6 ms 768 KB Correct : C = 200
20 Incorrect 5 ms 768 KB Wrong
21 Partially correct 6 ms 640 KB Partially correct : C = 435
22 Correct 5 ms 640 KB Correct : C = 119
23 Correct 6 ms 768 KB Correct : C = 200
24 Partially correct 6 ms 768 KB Partially correct : C = 302
25 Correct 5 ms 768 KB Correct : C = 120
26 Correct 5 ms 512 KB Correct : C = 4
27 Incorrect 6 ms 768 KB Wrong