답안 #762564

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
762564 2023-06-21T13:48:04 Z goodbyehanbyeol 로카히아 유적 (FXCUP4_lokahia) C++17
51 / 100
2 ms 596 KB
#include "lokahia.h"
#include <bits/stdc++.h>
using namespace std;

int FindBase(int n){
	if(n == 1) return 0;
	mt19937 gen(time(NULL));
	uniform_int_distribution<int> uid(0, n - 1);

	vector<int> cnt(n);
	int rep = 301;
	for(int i = 0; i < rep; ++i){
		int x = uid(gen), y = uid(gen);
		while(x == y){
			y = uid(gen);
		}
		int rv = CollectRelics(x, y);
		if(rv != -1){
			++cnt[rv];
		}
	}
	int mx = 0, pos = -1;
	for(int i = 0; i < n; ++i){
		if(cnt[i] > mx){
			mx = cnt[i];
			pos = i;
		}
	}
	if(pos == -1) return -1;

	int gocnt = 1;
	for(int i = 0; i < n; ++i){
		if(i == pos) continue;
		gocnt += (CollectRelics(pos, i) != -1);
	}
	if(gocnt > n / 2) return pos;
	return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 596 KB Partially correct : C = 301
2 Partially correct 1 ms 468 KB Partially correct : C = 420
3 Correct 0 ms 340 KB Correct : C = 0
4 Partially correct 1 ms 596 KB Partially correct : C = 500
5 Partially correct 1 ms 468 KB Partially correct : C = 420
6 Partially correct 1 ms 468 KB Partially correct : C = 301
7 Partially correct 1 ms 596 KB Partially correct : C = 500
8 Partially correct 1 ms 596 KB Partially correct : C = 301
9 Partially correct 1 ms 596 KB Partially correct : C = 499
10 Partially correct 1 ms 596 KB Partially correct : C = 500
11 Partially correct 1 ms 468 KB Partially correct : C = 419
12 Partially correct 1 ms 596 KB Partially correct : C = 500
13 Partially correct 1 ms 596 KB Partially correct : C = 499
14 Partially correct 1 ms 468 KB Partially correct : C = 419
15 Partially correct 1 ms 468 KB Partially correct : C = 419
16 Partially correct 1 ms 468 KB Partially correct : C = 420
17 Partially correct 1 ms 468 KB Partially correct : C = 420
18 Partially correct 1 ms 596 KB Partially correct : C = 499
19 Partially correct 2 ms 596 KB Partially correct : C = 499
20 Partially correct 1 ms 596 KB Partially correct : C = 499
21 Partially correct 2 ms 596 KB Partially correct : C = 499
22 Partially correct 1 ms 468 KB Partially correct : C = 305
23 Partially correct 1 ms 596 KB Partially correct : C = 500
24 Partially correct 1 ms 468 KB Partially correct : C = 301
25 Partially correct 1 ms 468 KB Partially correct : C = 419
26 Partially correct 1 ms 596 KB Partially correct : C = 500
27 Partially correct 1 ms 596 KB Partially correct : C = 500