Submission #247311

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