Submission #379166

# Submission time Handle Problem Language Result Execution time Memory
379166 2021-03-17T12:05:23 Z Mounir Game (IOI14_game) C++14
0 / 100
1 ms 492 KB
#include "game.h"
#include <vector>
using namespace std;

vector<int> ens;
int nNoeuds;

void initialize(int n) {
	nNoeuds = n;
	ens.resize(nNoeuds);
	for (int noeud = 0; noeud < nNoeuds; ++noeud)
		ens[noeud] = noeud;
}

int find(int noeud){
	if (ens[noeud] != noeud)
		ens[noeud] = find(ens[noeud]);
	return ens[noeud];
}

int hasEdge(int u, int v) {
    u = find(u), v = find(v);
    if (u != v)
    	return 1;
    if ((u < nNoeuds/2)^(v < nNoeuds/2)){
    	ens[u] = v;
    	return 1;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -