#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 n;
vector<int> adj[205];
int vis[205];
mt19937 rng(time(NULL));
void dfs(int u){
if(vis[u]) return;
vis[u] = 1;
for(int v : adj[u]){
dfs(v);
}
}
int go(int a){
fill(vis,vis+n,0);
dfs(a);
int cnt = 0;
for(int i = 0;i < n;i++) cnt += vis[i];
return cnt;
}
void rem(int x, vector<int> &stuff){
for(int i = 0;i < sz(stuff);i++){
if(stuff[i] == x){
swap(stuff[i], stuff.back());
stuff.pop_back();
break;
}
}
}
int FindBase(int N){
n = N;
int qrylimit = 600;
int total = 10000000;
vector<int> stuff;
for(int i = 0;i < n;i++){
stuff.push_back(i);
}
while(qrylimit > 0 and total > 0 and !stuff.empty()){
int a = stuff[rng()%sz(stuff)];
int b = stuff[rng()%sz(stuff)];
total--;
if(a == b) continue;
int x = CollectRelics(a,b); qrylimit--;
if(x != -1){
adj[x].push_back(a);
adj[x].push_back(b);
stuff.push_back(x);
if(x != a) rem(a, stuff);
if(x != b) rem(b, stuff);
}
}
for(int i = 0;i < n;i++){
if(go(i) > n/2) return i;
}
return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
318 ms |
748 KB |
Correct : C = 139 |
2 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
3 |
Partially correct |
2 ms |
620 KB |
Partially correct : C = 600 |
4 |
Partially correct |
2 ms |
620 KB |
Partially correct : C = 600 |
5 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
6 |
Correct |
334 ms |
620 KB |
Correct : C = 4 |
7 |
Correct |
329 ms |
620 KB |
Correct : C = 87 |
8 |
Partially correct |
3 ms |
620 KB |
Partially correct : C = 600 |
9 |
Partially correct |
2 ms |
620 KB |
Partially correct : C = 600 |
10 |
Partially correct |
2 ms |
620 KB |
Partially correct : C = 600 |
11 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
12 |
Incorrect |
2 ms |
620 KB |
Wrong |
13 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
14 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
15 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
16 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
17 |
Correct |
351 ms |
640 KB |
Correct : C = 0 |
18 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
19 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
20 |
Correct |
319 ms |
620 KB |
Correct : C = 150 |
21 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
22 |
Incorrect |
1 ms |
620 KB |
Wrong |
23 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
24 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
25 |
Correct |
319 ms |
772 KB |
Correct : C = 88 |
26 |
Partially correct |
1 ms |
620 KB |
Partially correct : C = 600 |
27 |
Partially correct |
2 ms |
620 KB |
Partially correct : C = 600 |