# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151240 | jun6873 | Lokahian Relics (FXCUP4_lokahia) | C++17 | 3 ms | 636 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) {
srand(20001021);
vector<int> ans;
for (int i=0; i<N; i++) ans.push_back(i);
int k;
while (ans.size() > 1) {
vector<int> nans;
if (ans.size() % 2) nans.push_back(ans.back());
for (int i=0; i+1<ans.size(); i+=2) {
if (ans[i] == ans[i+1]) nans.push_back(ans[i]);
else if ((k = CollectRelics(ans[i], ans[i+1])) != -1) nans.push_back(k);
}
ans = nans;
}
if (ans.empty()) return -1;
int cand = ans[0];
int cnt = 1;
for (int i=0; i<N; i++) if (i != cand) cnt += (CollectRelics(cand, i) != -1);
if (cnt > N/2) return cand;
return -1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |