# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
149225 | Ian and 2-bit memory (#200) | Trip to the Galapagos Islands (FXCUP4_island) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#include "lokahia.h"
int tmp;
int FindBase(int N){
if (N == 1)
return 0;
srand(123);
int left = 300 - (N - 1);
map<int, int> m;
while (left) {
int ta = rand() % N;
int tb = rand() % N;
if (ta == tb) continue;
printf("%d %d %d\n", ++tmp, ta, tb);
int tc = CollectRelics(ta, tb);
if (tc != -1)
m[tc]++;
left--;
}
int ans = -1, ma = -1;
//for (auto& i : m) printf("%d %d\n", i.first, i.second);
for (auto& i : m)
if (i.second >= ma) {
ans = i.first;
ma = i.second;
}
// printf("%d %d\n", ans, ma);
if (ans == -1)
return ans;
ma = 1;
for (int i = 0; i < N; i++)
if (i != ans)
ma += CollectRelics(i, ans) <= ans;
if (ma > N / 2)
return ans;
return -1;
}