제출 #149361

#제출 시각아이디문제언어결과실행 시간메모리
149361서울대학교 연구공원 944동 삼성전자서울대연구소 (#200)로카히아 유적 (FXCUP4_lokahia)C++17
0 / 100
8 ms768 KiB
#include "lokahia.h"

#include<bits/stdc++.h>
using namespace std;

mt19937_64 rng(94949);
int R(int a, int b)
{
	return uniform_int_distribution<int>(a, b)(rng);
}

int FindBase(int N){
	if(N==1) return 0;
	vector<int> cnt(N);
	for(int i=0; i<600-N+1; ++i)
	{
		int v1, v2;
		do
		{
			v1 = R(0, N-1);
			v2 = R(0, N-1);
		} while (v1==v2);
		int x = CollectRelics(v1, v2);
		if(x != -1) cnt[x] ++;
	}

	int maxi = max_element(cnt.begin(), cnt.end()) - cnt.begin();
	int cc = 1;
	for(int i=0; i<N; ++i)
		if(i != maxi && -1 != CollectRelics(maxi, i))
			++cc;
	if(cc > N/2) return maxi;
	else return -1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...