답안 #381627

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
381627 2021-03-25T11:25:42 Z ritul_kr_singh 게임 (IOI14_game) C++17
0 / 100
1 ms 364 KB
#include "game.h"
#include "bits/stdc++.h"
using namespace std;
 
vector<int> e;
int n;
int find(int u){
	return e[u] < 0 ? u : e[u] = find(e[u]);
}
int sz(int u){
	return -e[find(u)];
}
void unite(int u, int v){
	u = find(u), v = find(v);
	if(u==v) return;
	if(e[u] > e[v]) swap(u, v);
	e[u] += e[v], e[v] = u;
	--n;
}
 
 
void initialize(int N){
	n = N;
	e.assign(n+1, -1);
}
 
int hasEdge(int u, int v){
	if(find(u)==find(v) or n>2){
		unite(u, v);
		return 1;
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -