Submission #207141

#TimeUsernameProblemLanguageResultExecution timeMemory
207141aloo123Game (IOI14_game)C++14
100 / 100
426 ms7288 KiB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
using namespace std;

const ll N = 2e6+5;
const ll MOD = 1e9+7;
ll sz[1505];
ll par[1505];
ll cc;
bool fl = false;
ll a=-1,b=-1;
void make_set(ll nd){
	sz[nd] = 0;
	par[nd] = nd;
}

ll findpar(ll nd){
	if(par[nd] == nd) return nd;
	else return par[nd] = findpar(par[nd]);
}

void merge(ll u,ll v){
	u = findpar(u),v = findpar(v);
	if(u == v) return ;
	if(sz[u] > sz[v]) swap(u,v);
	sz[v] += sz[u];
	par[u] = v;
	cc--;
}

void initialize(int n){
	for(int i = 1;i<=n;i++) make_set(i);
	cc =n;
	
}

int hasEdge(int u, int v){
	if(u < v) swap(u,v);
	return (++sz[u] == u);
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...