Submission #247319

# Submission time Handle Problem Language Result Execution time Memory
247319 2020-07-11T08:44:47 Z oolimry Lokahian Relics (FXCUP4_lokahia) C++17
0 / 100
8 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 < 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;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 512 KB Correct : C = 0
2 Correct 7 ms 1784 KB Correct : C = 300
3 Correct 8 ms 1784 KB Correct : C = 300
4 Correct 8 ms 1784 KB Correct : C = 299
5 Correct 8 ms 1784 KB Correct : C = 299
6 Correct 5 ms 1024 KB Correct : C = 220
7 Correct 7 ms 1784 KB Correct : C = 299
8 Correct 5 ms 1024 KB Correct : C = 220
9 Correct 6 ms 1024 KB Correct : C = 219
10 Correct 5 ms 512 KB Correct : C = 105
11 Correct 8 ms 1784 KB Correct : C = 300
12 Correct 8 ms 1784 KB Correct : C = 300
13 Correct 6 ms 1024 KB Correct : C = 219
14 Incorrect 5 ms 896 KB Wrong
15 Correct 6 ms 1024 KB Correct : C = 219
16 Correct 8 ms 1784 KB Correct : C = 300
17 Correct 7 ms 1784 KB Correct : C = 299
18 Correct 8 ms 1784 KB Correct : C = 300
19 Correct 8 ms 1784 KB Correct : C = 299
20 Correct 6 ms 1024 KB Correct : C = 220
21 Correct 8 ms 1784 KB Correct : C = 300
22 Correct 6 ms 1024 KB Correct : C = 220
23 Correct 8 ms 1784 KB Correct : C = 299
24 Correct 5 ms 1024 KB Correct : C = 220
25 Correct 6 ms 1024 KB Correct : C = 219
26 Correct 8 ms 1784 KB Correct : C = 299
27 Correct 8 ms 1784 KB Correct : C = 300