Submission #149372

# Submission time Handle Problem Language Result Execution time Memory
149372 2019-09-01T06:21:00 Z 서울대학교 연구공원 944동 삼성전자서울대연구소(#3600, ho94949, dotorya, zigui) Lokahian Relics (FXCUP4_lokahia) C++17
39 / 100
8 ms 848 KB
#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-2*N+2; ++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();
	cnt[maxi] = 0;
	int maxi2 = 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;

	cc = 1;
	for(int i=0; i<N; ++i)
		if(i != maxi2 && -1 != CollectRelics(maxi2, i))
			++cc;
	if(cc > N/2) return maxi2;
	else return -1;
}
# Verdict Execution time Memory Grader output
1 Partially correct 6 ms 640 KB Partially correct : C = 600
2 Partially correct 8 ms 600 KB Partially correct : C = 600
3 Partially correct 6 ms 640 KB Partially correct : C = 600
4 Partially correct 6 ms 688 KB Partially correct : C = 600
5 Correct 5 ms 512 KB Correct : C = 0
6 Partially correct 6 ms 640 KB Partially correct : C = 600
7 Partially correct 7 ms 640 KB Partially correct : C = 401
8 Partially correct 6 ms 848 KB Partially correct : C = 401
9 Partially correct 6 ms 512 KB Partially correct : C = 482
10 Partially correct 7 ms 640 KB Partially correct : C = 402
11 Partially correct 7 ms 640 KB Partially correct : C = 600
12 Partially correct 7 ms 640 KB Partially correct : C = 600
13 Partially correct 7 ms 640 KB Partially correct : C = 402
14 Partially correct 7 ms 640 KB Partially correct : C = 401
15 Partially correct 6 ms 512 KB Partially correct : C = 600
16 Partially correct 6 ms 640 KB Partially correct : C = 402
17 Partially correct 6 ms 600 KB Partially correct : C = 481
18 Partially correct 7 ms 640 KB Partially correct : C = 401
19 Partially correct 7 ms 512 KB Partially correct : C = 481
20 Partially correct 7 ms 512 KB Partially correct : C = 600
21 Partially correct 6 ms 512 KB Partially correct : C = 600
22 Partially correct 6 ms 600 KB Partially correct : C = 482
23 Partially correct 6 ms 640 KB Partially correct : C = 481
24 Partially correct 6 ms 600 KB Partially correct : C = 600
25 Partially correct 6 ms 688 KB Partially correct : C = 482
26 Partially correct 7 ms 640 KB Partially correct : C = 402
27 Partially correct 6 ms 512 KB Partially correct : C = 596