#include "lokahia.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
int p[205];
int sz[205];
int findSet(int u){
if(u == p[u]) return u;
else return findSet(p[u]);
}
int SZ(int u){ return sz[findSet(u)]; }
void unionSet(int u, int P){
u = findSet(u), P = findSet(P);
p[u] = P;
sz[P] += sz[u];
}
int FindBase(int N){
srand(time(NULL));
vector<int> v;
if(N == 1){
return 0;
}
for(int i = 0;i < N;i++) v.push_back(i);
for(int i = 0;i < N;i++){
p[i] = i;
sz[i] = 1;
}
int cnt = 0;
map<int,int> occur;
while(cnt < 100){
int a = rand() % N, b = rand() % N;
if(a == b) continue;
if(a < N/3 && b < N/3) continue;
cnt++;
int x = CollectRelics(a,b);
occur[x]++;
}
int best = 0;
for(int i = 0;i < N;i++){
if(occur[best] < occur[i]){
best = i;
}
}
int total = 0;
for(int i = 0;i < N;i++){
if(i == best){
total++;
continue;
}
if(CollectRelics(i,best) != -1) total++;
}
//cout << best;
if(total > (N/2)) return best;
//assert(false);
//cout << best;
return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
640 KB |
Correct : C = 298 |
2 |
Correct |
5 ms |
640 KB |
Correct : C = 299 |
3 |
Correct |
5 ms |
640 KB |
Correct : C = 299 |
4 |
Correct |
5 ms |
640 KB |
Correct : C = 299 |
5 |
Correct |
6 ms |
640 KB |
Correct : C = 299 |
6 |
Correct |
6 ms |
640 KB |
Correct : C = 299 |
7 |
Correct |
5 ms |
512 KB |
Correct : C = 219 |
8 |
Correct |
6 ms |
640 KB |
Correct : C = 299 |
9 |
Correct |
5 ms |
640 KB |
Correct : C = 298 |
10 |
Correct |
6 ms |
512 KB |
Correct : C = 218 |
11 |
Correct |
5 ms |
640 KB |
Correct : C = 298 |
12 |
Correct |
5 ms |
640 KB |
Correct : C = 219 |
13 |
Correct |
5 ms |
640 KB |
Correct : C = 218 |
14 |
Correct |
5 ms |
640 KB |
Correct : C = 299 |
15 |
Correct |
5 ms |
640 KB |
Correct : C = 219 |
16 |
Correct |
5 ms |
512 KB |
Correct : C = 0 |
17 |
Correct |
5 ms |
640 KB |
Correct : C = 298 |
18 |
Correct |
6 ms |
512 KB |
Correct : C = 219 |
19 |
Correct |
5 ms |
640 KB |
Correct : C = 298 |
20 |
Correct |
5 ms |
512 KB |
Correct : C = 219 |
21 |
Correct |
5 ms |
512 KB |
Correct : C = 218 |
22 |
Incorrect |
5 ms |
640 KB |
Wrong |
23 |
Correct |
5 ms |
512 KB |
Correct : C = 218 |
24 |
Correct |
5 ms |
640 KB |
Correct : C = 299 |
25 |
Correct |
5 ms |
512 KB |
Correct : C = 218 |
26 |
Correct |
5 ms |
640 KB |
Correct : C = 298 |
27 |
Correct |
5 ms |
512 KB |
Correct : C = 104 |