Submission #247207

# Submission time Handle Problem Language Result Execution time Memory
247207 2020-07-11T07:55:12 Z dantoh000 Lokahian Relics (FXCUP4_lokahia) C++17
0 / 100
6 ms 896 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));
    vector<int> pos;
	int cur = 0;
	for (int i = 0; i < N; i++){
        if (cur == i) continue;
        int q = query(cur,i);
        if (q != -1 && q > min(cur,i)) 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 Correct 5 ms 768 KB Correct : C = 236
2 Correct 5 ms 640 KB Correct : C = 4
3 Correct 5 ms 768 KB Correct : C = 297
4 Partially correct 6 ms 768 KB Partially correct : C = 373
5 Correct 5 ms 768 KB Correct : C = 238
6 Correct 5 ms 768 KB Correct : C = 119
7 Incorrect 5 ms 768 KB Wrong
8 Partially correct 6 ms 768 KB Partially correct : C = 385
9 Correct 6 ms 896 KB Correct : C = 269
10 Incorrect 5 ms 768 KB Wrong
11 Correct 5 ms 768 KB Correct : C = 120
12 Correct 5 ms 768 KB Correct : C = 271
13 Correct 5 ms 768 KB Correct : C = 178
14 Partially correct 5 ms 768 KB Partially correct : C = 398
15 Correct 5 ms 768 KB Correct : C = 179
16 Correct 5 ms 768 KB Correct : C = 299
17 Correct 5 ms 768 KB Correct : C = 177
18 Correct 5 ms 768 KB Correct : C = 199
19 Correct 5 ms 768 KB Correct : C = 200
20 Correct 5 ms 800 KB Correct : C = 220
21 Correct 5 ms 768 KB Correct : C = 229
22 Partially correct 5 ms 768 KB Partially correct : C = 371
23 Partially correct 5 ms 768 KB Partially correct : C = 396
24 Correct 5 ms 640 KB Correct : C = 0
25 Correct 6 ms 768 KB Correct : C = 163
26 Correct 5 ms 768 KB Correct : C = 300
27 Partially correct 5 ms 768 KB Partially correct : C = 387