# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
762552 | goodbyehanbyeol | Lokahian Relics (FXCUP4_lokahia) | C++17 | 1089 ms | 716 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "lokahia.h"
#include <bits/stdc++.h>
using namespace std;
int FindBase(int n){
mt19937 gen(time(NULL));
uniform_int_distribution<int> uid(0, n - 1);
vector<int> cnt(n);
int rep = 250;
for(int i = 0; i < rep; ++i){
int x = uid(gen), y = uid(gen);
while(x == y){
y = uid(gen);
}
int rv = CollectRelics(x, y);
if(rv != -1){
++cnt[rv];
}
}
int mx = 0, pos = -1;
for(int i = 0; i < n; ++i){
if(cnt[i] > mx){
mx = cnt[i];
pos = i;
}
}
if(pos == -1) return -1;
int gocnt = 1;
for(int i = 0; i < n; ++i){
if(i == pos) continue;
gocnt += (CollectRelics(pos, i) != -1);
}
if(gocnt > n / 2) return pos;
return -1;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |