#include <bits/stdc++.h>
#include "lokahia.h"
#define maxn 205
using namespace std;
int cnt, ch[maxn][maxn];
const int mxs = 400;
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 |
Partially correct |
6 ms |
768 KB |
Partially correct : C = 400 |
2 |
Incorrect |
6 ms |
768 KB |
Wrong |
3 |
Incorrect |
6 ms |
768 KB |
Wrong |
4 |
Incorrect |
7 ms |
768 KB |
Wrong |
5 |
Incorrect |
6 ms |
816 KB |
Wrong |
6 |
Incorrect |
6 ms |
768 KB |
Wrong |
7 |
Incorrect |
6 ms |
640 KB |
Wrong |
8 |
Partially correct |
7 ms |
768 KB |
Partially correct : C = 400 |
9 |
Incorrect |
6 ms |
768 KB |
Wrong |
10 |
Incorrect |
6 ms |
768 KB |
Wrong |
11 |
Incorrect |
6 ms |
768 KB |
Wrong |
12 |
Incorrect |
6 ms |
768 KB |
Wrong |
13 |
Correct |
5 ms |
640 KB |
Correct : C = 0 |
14 |
Incorrect |
6 ms |
768 KB |
Wrong |
15 |
Incorrect |
6 ms |
696 KB |
Wrong |
16 |
Incorrect |
7 ms |
816 KB |
Wrong |
17 |
Incorrect |
6 ms |
768 KB |
Wrong |
18 |
Incorrect |
6 ms |
768 KB |
Wrong |
19 |
Partially correct |
6 ms |
768 KB |
Partially correct : C = 400 |
20 |
Incorrect |
6 ms |
768 KB |
Wrong |
21 |
Incorrect |
7 ms |
768 KB |
Wrong |
22 |
Incorrect |
6 ms |
768 KB |
Wrong |
23 |
Incorrect |
7 ms |
768 KB |
Wrong |
24 |
Incorrect |
6 ms |
768 KB |
Wrong |
25 |
Partially correct |
6 ms |
768 KB |
Partially correct : C = 400 |
26 |
Incorrect |
7 ms |
768 KB |
Wrong |
27 |
Incorrect |
6 ms |
768 KB |
Wrong |