답안 #247155

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
247155 2020-07-11T06:54:10 Z oolimry 로카히아 유적 (FXCUP4_lokahia) C++17
0 / 100
1000 ms 768 KB
#include "lokahia.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;

int p[205];
int sz[205];

int findSet(int u){
	if(u == p[u]) return u;
	else return findSet(p[u]);
}

int SZ(int u){ return sz[findSet(u)]; }

void unionSet(int u, int P){
	u = findSet(u), P = findSet(P);
	p[u] = P;
	sz[P] += sz[u];
}

int FindBase(int N){
	srand(time(NULL));
	vector<int> v;
	
	for(int i = 0;i < N;i++) v.push_back(i);
	
	for(int i = 0;i < N;i++){
		p[i] = i;
		sz[i] = 1;
	}
	
	int cnt = 0;
	map<int,int> occur;
	
	while(cnt < 400){
		int a = rand() % N, b = rand() % N;
		if(a == b) continue;
		
		cnt++;
		int x = CollectRelics(a,b);
		occur[x]++;
	}
	
	int best = 0;
	for(int i = 0;i < N;i++){
		if(occur[best] < occur[i]){
			best = i;
		}
	}
	
	int total = 0;
	for(int i = 0;i < N;i++){
		if(i == best){
			total++;
			continue;
		}
		
		if(CollectRelics(i,best) != -1) total++;
	}
	
	//cout << best;
	if(total > (N/2)) return best;
	//assert(false);
	//cout << best;
	return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 5 ms 640 KB Partially correct : C = 599
2 Partially correct 5 ms 512 KB Partially correct : C = 518
3 Partially correct 5 ms 640 KB Partially correct : C = 598
4 Partially correct 5 ms 640 KB Partially correct : C = 518
5 Partially correct 5 ms 640 KB Partially correct : C = 598
6 Partially correct 5 ms 640 KB Partially correct : C = 598
7 Partially correct 5 ms 512 KB Partially correct : C = 518
8 Partially correct 7 ms 640 KB Partially correct : C = 599
9 Partially correct 5 ms 640 KB Partially correct : C = 598
10 Partially correct 5 ms 640 KB Partially correct : C = 599
11 Partially correct 5 ms 640 KB Partially correct : C = 598
12 Partially correct 5 ms 512 KB Partially correct : C = 518
13 Partially correct 5 ms 640 KB Partially correct : C = 519
14 Partially correct 6 ms 512 KB Partially correct : C = 519
15 Partially correct 5 ms 640 KB Partially correct : C = 599
16 Execution timed out 1073 ms 512 KB Time limit exceeded
17 Partially correct 5 ms 640 KB Partially correct : C = 599
18 Partially correct 5 ms 640 KB Partially correct : C = 599
19 Partially correct 5 ms 640 KB Partially correct : C = 518
20 Partially correct 5 ms 512 KB Partially correct : C = 519
21 Partially correct 5 ms 640 KB Partially correct : C = 599
22 Partially correct 5 ms 640 KB Partially correct : C = 519
23 Partially correct 5 ms 640 KB Partially correct : C = 599
24 Partially correct 5 ms 512 KB Partially correct : C = 404
25 Partially correct 5 ms 512 KB Partially correct : C = 519
26 Incorrect 6 ms 768 KB Wrong
27 Partially correct 5 ms 640 KB Partially correct : C = 598