Submission #379440

#TimeUsernameProblemLanguageResultExecution timeMemory
379440oolimryLokahian Relics (FXCUP4_lokahia)C++17
0 / 100
343 ms768 KiB
#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; } int FindBase(int N){ n = N; int qrylimit = 600; int total = 10000000; while(qrylimit > 0 and total > 0){ int a = rng() % n, b = rng() % n; total--; if(a == b) continue; int x = CollectRelics(a,b); qrylimit--; if(x != -1){ adj[x].push_back(a); adj[x].push_back(b); } } for(int i = 0;i < n;i++){ if(go(i) > n/2) return i; } return -1; }
#Verdict Execution timeMemoryGrader output
Fetching results...