답안 #247313

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
247313 2020-07-11T08:43:34 Z oolimry 로카히아 유적 (FXCUP4_lokahia) C++17
0 / 100
10 ms 1784 KB
#include "lokahia.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;

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);

  int cnt = 0;
  map<int,int> occur;
  
  vector<int> P;
  for(int i = N/5;i < N;i++){
	for(int j = 0;j < i*sqrt(i);j++) P.push_back(i);  
  }
  
  while(cnt < 101){
    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++){
    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 6 ms 1024 KB Correct : C = 220
2 Correct 8 ms 1784 KB Correct : C = 300
3 Correct 9 ms 1784 KB Correct : C = 300
4 Correct 10 ms 1784 KB Correct : C = 299
5 Correct 8 ms 1784 KB Correct : C = 300
6 Incorrect 8 ms 1784 KB Wrong
7 Correct 8 ms 1784 KB Correct : C = 299
8 Correct 8 ms 1784 KB Correct : C = 299
9 Correct 6 ms 1024 KB Correct : C = 220
10 Correct 9 ms 1784 KB Correct : C = 300
11 Correct 6 ms 948 KB Correct : C = 219
12 Correct 7 ms 1784 KB Correct : C = 299
13 Correct 8 ms 1784 KB Correct : C = 299
14 Correct 8 ms 1784 KB Correct : C = 300
15 Correct 8 ms 1784 KB Correct : C = 299
16 Correct 6 ms 1024 KB Correct : C = 219
17 Correct 6 ms 896 KB Correct : C = 220
18 Correct 5 ms 512 KB Correct : C = 105
19 Incorrect 8 ms 1784 KB Wrong
20 Correct 5 ms 512 KB Correct : C = 0
21 Correct 6 ms 1024 KB Correct : C = 220
22 Correct 5 ms 1024 KB Correct : C = 220
23 Correct 8 ms 1784 KB Correct : C = 300
24 Correct 6 ms 1024 KB Correct : C = 219
25 Correct 6 ms 1024 KB Correct : C = 219
26 Correct 6 ms 1024 KB Correct : C = 219
27 Correct 8 ms 1784 KB Correct : C = 300