#include "lokahia.h"
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int) (x).size()
#define all(x) (x).begin(), (x).end()
#define show(x) cerr << #x << " is " << x << endl;
#define show2(x, y) cerr << #x << " is " << x << "," << #y << " is " << y << endl;
typedef long long lint;
typedef pair<lint,lint> ii;
int p[205];
int SZ[205];
int findSet(int u){
if(u == p[u]) return u;
else return p[u] = findSet(p[u]);
}
void unionSet(int u, int v){
u = findSet(u);
v = findSet(v);
if(u == v) return;
p[u] = v;
SZ[v] += SZ[u];
}
mt19937 rng(time(NULL));
int FindBase(int n){
int qrylimit = 600;
for(int i = 0;i <= n;i++) p[i] = i, SZ[i] = 1;
int total = 10000000;
while(qrylimit > 0 and total > 0){
int a = rng() % n, b = rng() % n;
total--;
if(a == b) continue;
if(findSet(a) == findSet(b) or findSet(a) != a or findSet(b) != b) continue;
int x = CollectRelics(a,b); qrylimit--;
if(x == -1) continue;
unionSet(a,x);
unionSet(b,x);
cout << a << " " << b << " " << x << "\n";
}
for(int i = 0;i < n;i++){
if(SZ[i] > n/2) return i;
}
return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
397 ms |
748 KB |
Wrong |
2 |
Incorrect |
2 ms |
620 KB |
Wrong |
3 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
4 |
Incorrect |
2 ms |
620 KB |
Wrong |
5 |
Incorrect |
11 ms |
620 KB |
Wrong |
6 |
Incorrect |
408 ms |
620 KB |
Wrong |
7 |
Incorrect |
150 ms |
748 KB |
Wrong |
8 |
Incorrect |
393 ms |
748 KB |
Wrong |
9 |
Incorrect |
2 ms |
620 KB |
Wrong |
10 |
Incorrect |
396 ms |
748 KB |
Wrong |
11 |
Correct |
347 ms |
492 KB |
Correct : C = 0 |
12 |
Incorrect |
2 ms |
620 KB |
Wrong |
13 |
Incorrect |
3 ms |
620 KB |
Wrong |
14 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
15 |
Incorrect |
343 ms |
748 KB |
Wrong |
16 |
Incorrect |
2 ms |
620 KB |
Wrong |
17 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
18 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
19 |
Incorrect |
2 ms |
620 KB |
Wrong |
20 |
Incorrect |
2 ms |
620 KB |
Wrong |
21 |
Incorrect |
2 ms |
620 KB |
Wrong |
22 |
Incorrect |
447 ms |
620 KB |
Wrong |
23 |
Incorrect |
2 ms |
620 KB |
Wrong |
24 |
Incorrect |
404 ms |
748 KB |
Wrong |
25 |
Incorrect |
2 ms |
620 KB |
Wrong |
26 |
Incorrect |
2 ms |
620 KB |
Wrong |
27 |
Incorrect |
402 ms |
748 KB |
Wrong |