답안 #247134

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
247134 2020-07-11T06:38:01 Z oolimry 로카히아 유적 (FXCUP4_lokahia) C++17
0 / 100
1000 ms 1152 KB
#include "lokahia.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;

int p[205];
int sz[205];

int findSet(int u){
	if(u == p[u]) return u;
	else return findSet(p[u]);
}

int SZ(int u){ return sz[findSet(u)]; }

void unionSet(int u, int P){
	u = findSet(u), P = findSet(P);
	p[u] = P;
	sz[P] += sz[u];
}

int FindBase(int N){
	srand(time(NULL));
	vector<int> v;
	
	for(int i = 0;i < N;i++) v.push_back(i);
	
	for(int i = 0;i < N;i++){
		p[i] = i;
		sz[i] = 1;
	}
	
	int cnt = 0;
	while(cnt < 600){
		int sz = v.size();
		int i = rand() % (sz);
		int j = rand() % (sz);
		if(i > j) swap(i,j);
		if(i == j) continue;
		
		int a = v[i], b = v[j];
		
		int x = CollectRelics(a, b);
		cnt++;
		if(x == -1) continue;
		
		vector<int> nxt;
		for(int k : v){
			if(k != a && k != b) nxt.push_back(k);
		}
		
		if(x == a || x == b) nxt.push_back(x);
		v = nxt;
		nxt.clear();
		
		if(a != x) unionSet(a,x);
		if(b != x) unionSet(b,x);
		if(SZ(x) > (N/2)){
			//cout << x << "\n";
			assert(false);
			return x;
		}
		
	}
	
	//assert(false);
	return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 5 ms 512 KB Partially correct : C = 600
2 Partially correct 5 ms 640 KB Partially correct : C = 600
3 Partially correct 5 ms 640 KB Partially correct : C = 600
4 Runtime error 6 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Partially correct 5 ms 640 KB Partially correct : C = 600
6 Partially correct 6 ms 640 KB Partially correct : C = 600
7 Runtime error 6 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Execution timed out 1085 ms 512 KB Time limit exceeded
9 Runtime error 6 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Partially correct 5 ms 640 KB Partially correct : C = 600
11 Partially correct 5 ms 640 KB Partially correct : C = 600
12 Runtime error 5 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 6 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 6 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 5 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Partially correct 5 ms 640 KB Partially correct : C = 600
17 Partially correct 6 ms 512 KB Partially correct : C = 600
18 Runtime error 6 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Incorrect 5 ms 640 KB Wrong
20 Runtime error 6 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 6 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Partially correct 5 ms 512 KB Partially correct : C = 600
23 Runtime error 6 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 6 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 5 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Partially correct 5 ms 512 KB Partially correct : C = 600
27 Runtime error 6 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)