Submission #149342

# Submission time Handle Problem Language Result Execution time Memory
149342 2019-09-01T06:17:01 Z 서울대학교 연구공원 944동 삼성전자서울대연구소(#3600, ho94949, dotorya, zigui) Lokahian Relics (FXCUP4_lokahia) C++17
0 / 100
8 ms 728 KB
#include "lokahia.h"

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

mt19937_64 rng(0x94949);
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<300-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 time Memory Grader output
1 Correct 6 ms 640 KB Correct : C = 300
2 Correct 6 ms 512 KB Correct : C = 300
3 Correct 7 ms 688 KB Correct : C = 300
4 Correct 6 ms 512 KB Correct : C = 300
5 Correct 6 ms 640 KB Correct : C = 300
6 Correct 8 ms 640 KB Correct : C = 300
7 Correct 6 ms 640 KB Correct : C = 300
8 Correct 7 ms 600 KB Correct : C = 300
9 Correct 7 ms 728 KB Correct : C = 300
10 Correct 7 ms 640 KB Correct : C = 300
11 Incorrect 6 ms 600 KB Wrong
12 Correct 6 ms 640 KB Correct : C = 300
13 Correct 6 ms 640 KB Correct : C = 300
14 Correct 6 ms 640 KB Correct : C = 300
15 Correct 6 ms 640 KB Correct : C = 300
16 Correct 7 ms 640 KB Correct : C = 300
17 Correct 7 ms 640 KB Correct : C = 300
18 Correct 7 ms 592 KB Correct : C = 300
19 Correct 6 ms 600 KB Correct : C = 300
20 Incorrect 7 ms 640 KB Wrong
21 Correct 6 ms 640 KB Correct : C = 300
22 Correct 7 ms 640 KB Correct : C = 300
23 Correct 6 ms 640 KB Correct : C = 300
24 Correct 6 ms 512 KB Correct : C = 300
25 Correct 6 ms 640 KB Correct : C = 300
26 Correct 6 ms 512 KB Correct : C = 0
27 Correct 6 ms 600 KB Correct : C = 300