Submission #247205

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