Submission #762566

# Submission time Handle Problem Language Result Execution time Memory
762566 2023-06-21T13:49:21 Z goodbyehanbyeol Lokahian Relics (FXCUP4_lokahia) C++17
100 / 100
1 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 = 101;
	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;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Correct : C = 299
2 Correct 1 ms 596 KB Correct : C = 300
3 Correct 1 ms 596 KB Correct : C = 101
4 Correct 1 ms 596 KB Correct : C = 300
5 Correct 1 ms 596 KB Correct : C = 300
6 Correct 0 ms 468 KB Correct : C = 101
7 Correct 1 ms 596 KB Correct : C = 299
8 Correct 1 ms 596 KB Correct : C = 299
9 Correct 0 ms 468 KB Correct : C = 101
10 Correct 1 ms 468 KB Correct : C = 219
11 Correct 1 ms 596 KB Correct : C = 299
12 Correct 1 ms 468 KB Correct : C = 220
13 Correct 1 ms 596 KB Correct : C = 299
14 Correct 1 ms 596 KB Correct : C = 299
15 Correct 1 ms 596 KB Correct : C = 300
16 Correct 1 ms 468 KB Correct : C = 220
17 Correct 1 ms 468 KB Correct : C = 219
18 Correct 1 ms 468 KB Correct : C = 219
19 Correct 1 ms 596 KB Correct : C = 300
20 Correct 0 ms 340 KB Correct : C = 0
21 Correct 1 ms 468 KB Correct : C = 220
22 Correct 1 ms 596 KB Correct : C = 300
23 Correct 0 ms 468 KB Correct : C = 219
24 Correct 0 ms 468 KB Correct : C = 105
25 Correct 1 ms 596 KB Correct : C = 300
26 Correct 1 ms 468 KB Correct : C = 220
27 Correct 1 ms 596 KB Correct : C = 101