Submission #762565

# Submission time Handle Problem Language Result Execution time Memory
762565 2023-06-21T13:48:42 Z goodbyehanbyeol Lokahian Relics (FXCUP4_lokahia) C++17
77 / 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 = 201;
	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 Partially correct 1 ms 468 KB Partially correct : C = 320
2 Partially correct 1 ms 596 KB Partially correct : C = 399
3 Partially correct 1 ms 468 KB Partially correct : C = 320
4 Partially correct 1 ms 596 KB Partially correct : C = 400
5 Partially correct 1 ms 596 KB Partially correct : C = 400
6 Partially correct 1 ms 468 KB Partially correct : C = 319
7 Partially correct 1 ms 548 KB Partially correct : C = 319
8 Partially correct 1 ms 596 KB Partially correct : C = 400
9 Partially correct 1 ms 596 KB Partially correct : C = 399
10 Partially correct 1 ms 596 KB Partially correct : C = 399
11 Correct 1 ms 596 KB Correct : C = 201
12 Correct 0 ms 340 KB Correct : C = 0
13 Partially correct 1 ms 596 KB Partially correct : C = 400
14 Partially correct 1 ms 596 KB Partially correct : C = 400
15 Partially correct 1 ms 468 KB Partially correct : C = 319
16 Partially correct 1 ms 596 KB Partially correct : C = 399
17 Partially correct 1 ms 596 KB Partially correct : C = 400
18 Correct 1 ms 596 KB Correct : C = 201
19 Correct 1 ms 468 KB Correct : C = 205
20 Partially correct 1 ms 596 KB Partially correct : C = 400
21 Partially correct 1 ms 468 KB Partially correct : C = 319
22 Partially correct 1 ms 596 KB Partially correct : C = 399
23 Partially correct 0 ms 468 KB Partially correct : C = 320
24 Correct 1 ms 468 KB Correct : C = 201
25 Correct 0 ms 468 KB Correct : C = 201
26 Partially correct 1 ms 536 KB Partially correct : C = 320
27 Partially correct 1 ms 596 KB Partially correct : C = 399