답안 #379471

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
379471 2021-03-18T09:56:08 Z oolimry 로카히아 유적 (FXCUP4_lokahia) C++17
0 / 100
458 ms 1132 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;
		int x = CollectRelics(a,b); qrylimit--;
		
		if(x == -1) continue;
		
		if(findSet(a) != findSet(x) and findSet(b) != findSet(x)){
			unionSet(a,x);
			unionSet(b,x);
		}
		else if(findSet(x) == findSet(a)){
			unionSet(b,a);
		}
		else unionSet(a,b);
		
		cout << a << " " << b << " " << x << "\n";
	}
	
	for(int i = 0;i < n;i++){
		if(SZ[i] > n/2) return i;
	}
	assert(false);
	return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 399 ms 700 KB Wrong
2 Incorrect 2 ms 620 KB Wrong
3 Incorrect 2 ms 620 KB Wrong
4 Incorrect 1 ms 620 KB Wrong
5 Incorrect 2 ms 620 KB Wrong
6 Runtime error 3 ms 1132 KB Execution killed with signal 6
7 Runtime error 2 ms 1132 KB Execution killed with signal 6
8 Runtime error 2 ms 1132 KB Execution killed with signal 6
9 Runtime error 2 ms 1004 KB Execution killed with signal 6
10 Runtime error 3 ms 1132 KB Execution killed with signal 6
11 Incorrect 403 ms 640 KB Wrong
12 Incorrect 458 ms 620 KB Wrong
13 Incorrect 1 ms 620 KB Wrong
14 Runtime error 3 ms 1132 KB Execution killed with signal 6
15 Runtime error 2 ms 1004 KB Execution killed with signal 6
16 Incorrect 402 ms 700 KB Wrong
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 Incorrect 400 ms 640 KB Wrong
20 Runtime error 3 ms 1132 KB Execution killed with signal 6
21 Runtime error 2 ms 1132 KB Execution killed with signal 6
22 Correct 341 ms 544 KB Correct : C = 0
23 Runtime error 3 ms 1132 KB Execution killed with signal 6
24 Runtime error 2 ms 1132 KB Execution killed with signal 6
25 Incorrect 1 ms 620 KB Wrong
26 Runtime error 2 ms 1004 KB Execution killed with signal 6
27 Incorrect 1 ms 620 KB Wrong