Submission #247196

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