Submission #149509

# Submission time Handle Problem Language Result Execution time Memory
149509 2019-09-01T06:38:05 Z 서울대학교 연구공원 944동 삼성전자서울대연구소(#3600, ho94949, dotorya, zigui) Lokahian Relics (FXCUP4_lokahia) C++17
0 / 100
7 ms 640 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<400-2*N+3; ++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] = -1;
	int maxi2 = max_element(cnt.begin(), cnt.end()) - cnt.begin();
	int cc = 1;
	int mim2=0;
	for(int i=0; i<N; ++i)
		if(i != maxi && -1 != CollectRelics(maxi, i))
		{
			++cc;
			if(i==maxi2) mim2=1;
		}
	if(cc > N/2) return maxi;

	cc = 1 + mim2;
	for(int i=0; i<N; ++i)
		if(i != maxi2 && i!=maxi && -1 != CollectRelics(maxi2, i))
			++cc;
	if(cc > N/2) return maxi2;
	else return -1;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 640 KB Correct : C = 202
2 Correct 6 ms 512 KB Correct : C = 282
3 Partially correct 7 ms 640 KB Partially correct : C = 400
4 Correct 5 ms 512 KB Correct : C = 0
5 Partially correct 6 ms 640 KB Partially correct : C = 400
6 Correct 6 ms 512 KB Correct : C = 282
7 Correct 7 ms 640 KB Correct : C = 203
8 Partially correct 6 ms 640 KB Partially correct : C = 400
9 Incorrect 6 ms 512 KB Wrong
10 Correct 6 ms 640 KB Correct : C = 202
11 Correct 6 ms 512 KB Correct : C = 283
12 Correct 6 ms 512 KB Correct : C = 282
13 Partially correct 6 ms 512 KB Partially correct : C = 400
14 Correct 6 ms 640 KB Correct : C = 203
15 Partially correct 6 ms 640 KB Partially correct : C = 400
16 Partially correct 6 ms 640 KB Partially correct : C = 400
17 Correct 6 ms 512 KB Correct : C = 283
18 Partially correct 6 ms 640 KB Partially correct : C = 400
19 Correct 6 ms 512 KB Correct : C = 283
20 Correct 6 ms 640 KB Correct : C = 203
21 Partially correct 6 ms 512 KB Partially correct : C = 397
22 Correct 7 ms 640 KB Correct : C = 202
23 Partially correct 6 ms 512 KB Partially correct : C = 400
24 Partially correct 6 ms 512 KB Partially correct : C = 400
25 Partially correct 6 ms 640 KB Partially correct : C = 400
26 Partially correct 6 ms 512 KB Partially correct : C = 400
27 Correct 7 ms 640 KB Correct : C = 203