답안 #149327

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149327 2019-09-01T06:15:28 Z Ian and 2-bit memory(#3648, percywtc, nhho, ulna) 로카히아 유적 (FXCUP4_lokahia) C++17
0 / 100
8 ms 720 KB
#include <bits/stdc++.h>

using namespace std;


#include "lokahia.h"
int tmp;

int FindBase(int N){
if (N == 1)
	return 0;
srand(123);
	int left = 300 - (N - 1);
	map<int, int> m;
	while (left) {
		int ta = rand() % N;
		int tb = rand() % N;
		if (ta == tb) continue;
		// printf("%d  %d %d\n", ++tmp, ta, tb);
		int tc = CollectRelics(ta, tb);
		if (tc != -1)
		m[tc]++;
		left--;
	}
	int ans = -1, ma = -1;
	//for (auto& i : m) printf("%d %d\n", i.first, i.second);
	for (auto& i : m)
		if (i.second >= ma) {
			ans = i.first;
			ma = i.second;
		}
	// printf("%d %d\n", ans, ma);
	if (ans == -1)
		return ans;
	ma = 1;
	for (int i = 0; i < N; i++)
		if (i != ans) {
			int ta = CollectRelics(i, ans);
			if (ta <= ans && ta != -1) {
				ma++;
				ans = ta;
			}
		}
	if (ma > N / 2)
		return ans;
	return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 640 KB Correct : C = 300
2 Correct 7 ms 720 KB Correct : C = 300
3 Correct 6 ms 600 KB Correct : C = 300
4 Correct 6 ms 640 KB Correct : C = 300
5 Correct 6 ms 512 KB Correct : C = 0
6 Correct 7 ms 592 KB Correct : C = 101
7 Correct 6 ms 640 KB Correct : C = 181
8 Correct 6 ms 568 KB Correct : C = 300
9 Correct 6 ms 640 KB Correct : C = 300
10 Correct 7 ms 640 KB Correct : C = 300
11 Correct 7 ms 640 KB Correct : C = 300
12 Incorrect 7 ms 512 KB Wrong
13 Correct 7 ms 600 KB Correct : C = 182
14 Correct 6 ms 640 KB Correct : C = 300
15 Correct 7 ms 600 KB Correct : C = 300
16 Correct 6 ms 640 KB Correct : C = 300
17 Correct 6 ms 600 KB Correct : C = 102
18 Correct 6 ms 640 KB Correct : C = 300
19 Correct 7 ms 640 KB Correct : C = 300
20 Correct 6 ms 640 KB Correct : C = 300
21 Correct 8 ms 640 KB Correct : C = 300
22 Correct 8 ms 640 KB Correct : C = 300
23 Correct 7 ms 640 KB Correct : C = 300
24 Correct 7 ms 656 KB Correct : C = 300
25 Correct 6 ms 640 KB Correct : C = 300
26 Correct 6 ms 640 KB Correct : C = 300
27 Correct 7 ms 640 KB Correct : C = 300