Submission #247200

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