Submission #247318

# Submission time Handle Problem Language Result Execution time Memory
247318 2020-07-11T08:44:41 Z dantoh000 Lokahian Relics (FXCUP4_lokahia) C++17
51 / 100
7 ms 896 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 (tq >= 404) return -1;
    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 <= 404){
        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;
        good.clear();
        for (auto x : bad){
            good.push_back(x);
        }
        bad.clear();
    }
    return -1;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 896 KB Correct : C = 200
2 Partially correct 6 ms 768 KB Partially correct : C = 302
3 Correct 5 ms 512 KB Correct : C = 0
4 Correct 5 ms 640 KB Correct : C = 119
5 Correct 5 ms 640 KB Correct : C = 120
6 Correct 5 ms 768 KB Correct : C = 199
7 Correct 5 ms 640 KB Correct : C = 120
8 Partially correct 6 ms 640 KB Partially correct : C = 404
9 Correct 7 ms 768 KB Correct : C = 200
10 Partially correct 5 ms 768 KB Partially correct : C = 404
11 Correct 5 ms 768 KB Correct : C = 119
12 Partially correct 6 ms 768 KB Partially correct : C = 404
13 Partially correct 5 ms 640 KB Partially correct : C = 404
14 Partially correct 6 ms 768 KB Partially correct : C = 404
15 Correct 5 ms 768 KB Correct : C = 200
16 Correct 5 ms 768 KB Correct : C = 300
17 Partially correct 5 ms 768 KB Partially correct : C = 404
18 Partially correct 5 ms 768 KB Partially correct : C = 404
19 Correct 5 ms 640 KB Correct : C = 120
20 Correct 5 ms 768 KB Correct : C = 199
21 Partially correct 5 ms 768 KB Partially correct : C = 368
22 Partially correct 5 ms 768 KB Partially correct : C = 404
23 Partially correct 6 ms 768 KB Partially correct : C = 404
24 Partially correct 5 ms 640 KB Partially correct : C = 404
25 Correct 5 ms 768 KB Correct : C = 200
26 Correct 5 ms 512 KB Correct : C = 4
27 Correct 5 ms 640 KB Correct : C = 121