Submission #247307

# Submission time Handle Problem Language Result Execution time Memory
247307 2020-07-11T08:42:02 Z oolimry Lokahian Relics (FXCUP4_lokahia) C++17
0 / 100
31 ms 17256 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*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 27 ms 17248 KB Correct : C = 300
2 Correct 27 ms 17256 KB Correct : C = 300
3 Correct 27 ms 17256 KB Correct : C = 299
4 Correct 27 ms 17256 KB Correct : C = 299
5 Correct 27 ms 17176 KB Correct : C = 300
6 Correct 27 ms 17256 KB Correct : C = 300
7 Incorrect 27 ms 17248 KB Wrong
8 Correct 10 ms 4848 KB Correct : C = 219
9 Correct 10 ms 4848 KB Correct : C = 219
10 Correct 5 ms 512 KB Correct : C = 105
11 Correct 10 ms 4848 KB Correct : C = 220
12 Correct 11 ms 4848 KB Correct : C = 220
13 Correct 10 ms 4848 KB Correct : C = 219
14 Correct 10 ms 4848 KB Correct : C = 219
15 Correct 29 ms 17248 KB Correct : C = 300
16 Incorrect 27 ms 17256 KB Wrong
17 Correct 31 ms 17256 KB Correct : C = 300
18 Correct 28 ms 17256 KB Correct : C = 299
19 Correct 28 ms 17248 KB Correct : C = 299
20 Correct 28 ms 17256 KB Correct : C = 299
21 Correct 27 ms 17256 KB Correct : C = 299
22 Correct 5 ms 512 KB Correct : C = 0
23 Correct 10 ms 4768 KB Correct : C = 220
24 Correct 10 ms 4848 KB Correct : C = 220
25 Correct 27 ms 17248 KB Correct : C = 300
26 Correct 10 ms 4848 KB Correct : C = 220
27 Correct 10 ms 4848 KB Correct : C = 219