답안 #247321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
247321 2020-07-11T08:45:47 Z oolimry 로카히아 유적 (FXCUP4_lokahia) C++17
0 / 100
9 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/3;i < N;i++){
	for(int j = 0;j < i*sqrt(i);j++) P.push_back(i);  
  }
  
  while(cnt < 151){
    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 5 ms 1024 KB Correct : C = 270
2 Correct 6 ms 896 KB Correct : C = 270
3 Partially correct 8 ms 1784 KB Partially correct : C = 350
4 Partially correct 8 ms 1784 KB Partially correct : C = 350
5 Correct 5 ms 512 KB Correct : C = 155
6 Correct 5 ms 1024 KB Correct : C = 269
7 Partially correct 7 ms 1784 KB Partially correct : C = 349
8 Partially correct 8 ms 1784 KB Partially correct : C = 350
9 Partially correct 8 ms 1784 KB Partially correct : C = 349
10 Correct 6 ms 1024 KB Correct : C = 269
11 Partially correct 8 ms 1784 KB Partially correct : C = 350
12 Correct 5 ms 1024 KB Correct : C = 270
13 Partially correct 8 ms 1784 KB Partially correct : C = 350
14 Correct 6 ms 1024 KB Correct : C = 270
15 Incorrect 9 ms 1784 KB Wrong
16 Partially correct 8 ms 1784 KB Partially correct : C = 349
17 Correct 6 ms 1024 KB Correct : C = 269
18 Partially correct 8 ms 1784 KB Partially correct : C = 349
19 Partially correct 8 ms 1784 KB Partially correct : C = 350
20 Correct 6 ms 1024 KB Correct : C = 270
21 Partially correct 7 ms 1784 KB Partially correct : C = 350
22 Correct 6 ms 1024 KB Correct : C = 269
23 Correct 6 ms 1024 KB Correct : C = 269
24 Partially correct 8 ms 1784 KB Partially correct : C = 349
25 Partially correct 8 ms 1784 KB Partially correct : C = 349
26 Incorrect 8 ms 1784 KB Wrong
27 Correct 5 ms 512 KB Correct : C = 0