Submission #247210

# Submission time Handle Problem Language Result Execution time Memory
247210 2020-07-11T08:00:40 Z dantoh000 Lokahian Relics (FXCUP4_lokahia) C++17
0 / 100
6 ms 800 KB
#include <bits/stdc++.h>
using namespace std;
#include "lokahia.h"
int Q[205][205];
int query(int i, int j){
    if (i == j) return Q[i][i] = i;
    else if (Q[i][j] == -1) return Q[i][j] = Q[j][i] = CollectRelics(i,j);
    else return Q[i][j];
}
int FindBase(int N){
    memset(Q,-1,sizeof(Q));
	int cur = 0;
	vector<int> pos;
	for (int i = 0; i < N; i++){
        int q = query(0,i);
        if (q != -1) pos.push_back(i);
	}
	for (auto x : pos){
        int q = query(cur,x);
        if (q != -1 && q > cur) cur = q;
	}
    int ct = 0;
    for (int i = 0; i < N; i++){
        if (i == cur || query(i,cur) != -1) ct++;
        if (ct > N/2) break;
    }
    if (ct > N/2) return cur;
    else return -1;
}
# Verdict Execution time Memory Grader output
1 Partially correct 5 ms 768 KB Partially correct : C = 383
2 Partially correct 5 ms 768 KB Partially correct : C = 382
3 Correct 5 ms 768 KB Correct : C = 227
4 Partially correct 5 ms 768 KB Partially correct : C = 397
5 Correct 5 ms 768 KB Correct : C = 237
6 Correct 5 ms 768 KB Correct : C = 236
7 Incorrect 5 ms 768 KB Wrong
8 Correct 5 ms 768 KB Correct : C = 234
9 Partially correct 5 ms 768 KB Partially correct : C = 396
10 Partially correct 5 ms 768 KB Partially correct : C = 398
11 Partially correct 6 ms 768 KB Partially correct : C = 397
12 Partially correct 5 ms 800 KB Partially correct : C = 395
13 Partially correct 6 ms 768 KB Partially correct : C = 395
14 Correct 5 ms 768 KB Correct : C = 237
15 Partially correct 5 ms 768 KB Partially correct : C = 397
16 Partially correct 5 ms 768 KB Partially correct : C = 397
17 Partially correct 5 ms 768 KB Partially correct : C = 395
18 Partially correct 5 ms 768 KB Partially correct : C = 396
19 Correct 5 ms 768 KB Correct : C = 220
20 Partially correct 5 ms 768 KB Partially correct : C = 397
21 Correct 5 ms 640 KB Correct : C = 7
22 Correct 5 ms 768 KB Correct : C = 235
23 Incorrect 5 ms 768 KB Wrong
24 Correct 5 ms 640 KB Correct : C = 0
25 Correct 5 ms 768 KB Correct : C = 238
26 Correct 5 ms 768 KB Correct : C = 229
27 Correct 5 ms 768 KB Correct : C = 235