답안 #247328

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
247328 2020-07-11T08:47:13 Z oolimry 로카히아 유적 (FXCUP4_lokahia) C++17
0 / 100
39 ms 17256 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;
 
  if(N == 1){
	return 0;
  }
 
  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;
  
  vector<int> P;
  for(int i = N/4;i < N;i++){
	for(int j = 0;j < i*i;j++) P.push_back(i);  
  }
  
  while(cnt < 200){
	int a = P[rand() % P.size()], b = P[rand() % P.size()];
	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 += 2){
	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 Correct 29 ms 17256 KB Correct : C = 299
2 Correct 10 ms 4848 KB Correct : C = 259
3 Incorrect 10 ms 4848 KB Wrong
4 Incorrect 11 ms 4848 KB Wrong
5 Correct 27 ms 17256 KB Correct : C = 300
6 Incorrect 10 ms 4848 KB Wrong
7 Correct 31 ms 17256 KB Correct : C = 299
8 Incorrect 29 ms 17256 KB Wrong
9 Correct 28 ms 17248 KB Correct : C = 300
10 Correct 27 ms 17256 KB Correct : C = 299
11 Correct 5 ms 512 KB Correct : C = 0
12 Correct 10 ms 4848 KB Correct : C = 260
13 Incorrect 35 ms 17240 KB Wrong
14 Incorrect 10 ms 4848 KB Wrong
15 Correct 28 ms 17256 KB Correct : C = 299
16 Correct 39 ms 17240 KB Correct : C = 299
17 Correct 27 ms 17256 KB Correct : C = 299
18 Correct 10 ms 4848 KB Correct : C = 259
19 Incorrect 27 ms 17248 KB Wrong
20 Incorrect 28 ms 17256 KB Wrong
21 Correct 5 ms 512 KB Correct : C = 203
22 Incorrect 26 ms 17256 KB Wrong
23 Incorrect 33 ms 17256 KB Wrong
24 Correct 11 ms 4848 KB Correct : C = 259
25 Correct 10 ms 4848 KB Correct : C = 259
26 Incorrect 28 ms 17256 KB Wrong
27 Incorrect 10 ms 4848 KB Wrong