#include <bits/stdc++.h>
#include "lokahia.h"
#define maxn 205
using namespace std;
int cnt, ch[maxn][maxn];
const int mxs = 600;
int q(int a, int b) {
if (cnt >= mxs) return -1;
if (ch[a][b] != -1) return ch[a][b] - 1;
cnt++;
ch[a][b] = ch[b][a] = CollectRelics(a, b) + 1;
return ch[a][b] - 1;
}
int fl[maxn];
int d[maxn];
int FindBase(int N) {
cnt = 0;
for (int i = 0; i < N; i++)
d[i] = i;
memset(ch, -1, sizeof(ch));
while (1) {
memset(fl, 0, sizeof(fl));
random_shuffle(d, d + N);
int nr = d[0], sz = 0;
for (int i = 1; i < N; i++)
{
int nans = q(nr, d[i]);
if (nans == -1) continue;
else
sz++, nr = nans;
}
// cout << nr << ' ' << sz << endl;
if (sz >= N / 2) return nr;
if (cnt >= mxs) break;
}
return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
768 KB |
Wrong |
2 |
Incorrect |
6 ms |
768 KB |
Wrong |
3 |
Correct |
6 ms |
640 KB |
Correct : C = 0 |
4 |
Incorrect |
6 ms |
768 KB |
Wrong |
5 |
Incorrect |
6 ms |
768 KB |
Wrong |
6 |
Incorrect |
5 ms |
688 KB |
Wrong |
7 |
Partially correct |
6 ms |
768 KB |
Partially correct : C = 600 |
8 |
Incorrect |
6 ms |
768 KB |
Wrong |
9 |
Incorrect |
6 ms |
768 KB |
Wrong |
10 |
Incorrect |
6 ms |
792 KB |
Wrong |
11 |
Incorrect |
6 ms |
768 KB |
Wrong |
12 |
Incorrect |
5 ms |
768 KB |
Wrong |
13 |
Incorrect |
7 ms |
768 KB |
Wrong |
14 |
Incorrect |
6 ms |
768 KB |
Wrong |
15 |
Incorrect |
6 ms |
640 KB |
Wrong |
16 |
Partially correct |
5 ms |
768 KB |
Partially correct : C = 600 |
17 |
Incorrect |
5 ms |
768 KB |
Wrong |
18 |
Incorrect |
6 ms |
768 KB |
Wrong |
19 |
Incorrect |
6 ms |
768 KB |
Wrong |
20 |
Partially correct |
6 ms |
768 KB |
Partially correct : C = 600 |
21 |
Incorrect |
6 ms |
768 KB |
Wrong |
22 |
Incorrect |
6 ms |
768 KB |
Wrong |
23 |
Incorrect |
6 ms |
768 KB |
Wrong |
24 |
Incorrect |
6 ms |
768 KB |
Wrong |
25 |
Incorrect |
6 ms |
768 KB |
Wrong |
26 |
Partially correct |
6 ms |
768 KB |
Partially correct : C = 600 |
27 |
Incorrect |
6 ms |
768 KB |
Wrong |