Submission #379469

# Submission time Handle Problem Language Result Execution time Memory
379469 2021-03-18T09:51:24 Z oolimry Lokahian Relics (FXCUP4_lokahia) C++17
0 / 100
451 ms 1152 KB
#include "lokahia.h"
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int) (x).size()
#define all(x) (x).begin(), (x).end()
#define show(x) cerr << #x << " is " << x << endl;
#define show2(x, y) cerr << #x << " is " << x << "," << #y << " is " << y << endl;
typedef long long lint;
typedef pair<lint,lint> ii;
 
int p[205];
int SZ[205];
int findSet(int u){
	if(u == p[u]) return u;
	else return p[u] = findSet(p[u]);
}
void unionSet(int u, int v){
	u = findSet(u);
	v = findSet(v);
	if(u == v) return;
	p[u] = v;
	SZ[v] += SZ[u];
}
 
mt19937 rng(time(NULL));
 
int FindBase(int n){
	int qrylimit = 600;
	for(int i = 0;i <= n;i++) p[i] = i, SZ[i] = 1;
	int total = 10000000;
	
	while(qrylimit >  0 and total > 0){
		int a = rng() % n, b = rng() % n;
		total--;
		
		if(a == b) continue;
		
		if(findSet(a) == findSet(b)) continue;
		a = findSet(a); b = findSet(b);
		int x = CollectRelics(a,b); qrylimit--;
		
		if(x == -1) continue;
		unionSet(a,x);
		unionSet(b,x);
		
		cout << a << " " << b << " " << x << "\n";
	}
	
	for(int i = 0;i < n;i++){
		if(SZ[i] > n/2) return i;
	}
  assert(false);
	return -1;
}
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 1132 KB Execution killed with signal 6
2 Correct 346 ms 492 KB Correct : C = 0
3 Runtime error 2 ms 1132 KB Execution killed with signal 6
4 Runtime error 3 ms 1132 KB Execution killed with signal 6
5 Incorrect 405 ms 748 KB Wrong
6 Incorrect 451 ms 492 KB Wrong
7 Incorrect 403 ms 700 KB Wrong
8 Runtime error 2 ms 1132 KB Execution killed with signal 6
9 Incorrect 408 ms 748 KB Wrong
10 Incorrect 1 ms 620 KB Wrong
11 Incorrect 1 ms 620 KB Wrong
12 Runtime error 2 ms 1152 KB Execution killed with signal 6
13 Runtime error 2 ms 1132 KB Execution killed with signal 6
14 Incorrect 1 ms 620 KB Wrong
15 Runtime error 2 ms 1132 KB Execution killed with signal 6
16 Runtime error 2 ms 1132 KB Execution killed with signal 6
17 Runtime error 2 ms 1132 KB Execution killed with signal 6
18 Runtime error 2 ms 1004 KB Execution killed with signal 6
19 Runtime error 2 ms 1004 KB Execution killed with signal 6
20 Runtime error 2 ms 1004 KB Execution killed with signal 6
21 Runtime error 2 ms 1004 KB Execution killed with signal 6
22 Incorrect 403 ms 748 KB Wrong
23 Incorrect 1 ms 620 KB Wrong
24 Runtime error 2 ms 1132 KB Execution killed with signal 6
25 Incorrect 1 ms 748 KB Wrong
26 Incorrect 1 ms 620 KB Wrong
27 Runtime error 2 ms 1132 KB Execution killed with signal 6