Submission #30446

# Submission time Handle Problem Language Result Execution time Memory
30446 2017-07-23T11:17:10 Z inqr Game (IOI14_game) C++14
0 / 100
0 ms 10824 KB
#include "game.h"
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rt insert
#define st first
#define nd second
#define ll long long
#define pii pair < int , int >
#define DB printf("debug\n");
#define umax( x , y ) x = max( x , (y) )
#define umin( x , y ) x = min( x , (y) )
#define all(x) x.begin() , x.end()
using namespace std;
int conto[1505];
int conmx[1505];
int root[1505];
int N,totno,maxque,maxyes,maxno;
int rootfind(int a){
	if(root[a]==a)return a;
	return root[a]=rootfind(root[a]);
}
void merge(int a,int b){
	root[b]=root[a]=max(rootfind(a),rootfind(b));
	conmx[root[a]]=conmx[a]+conmx[b]-1;
}
void initialize(int n) {
	N=n;
	maxque=(n)*(n-1)/(2);
	maxyes=n-1;
	maxno=maxque-maxyes;
	for(int i=0;i<n;i++){
		root[n]=n;
		conto[n]=0;
		conmx[n]=n-2;
	}
	//printf("n=%d maxque=%d maxyes=%d maxno=%d\n",n,maxque,maxyes,maxno);
}
int hasEdge2(int u,int v){
	if(conmx[rootfind(u)]==0||conmx[rootfind(v)]==0){
		merge(u,v);
		return 1;
	}
	conmx[rootfind(u)]--;
	conmx[rootfind(v)]--;
	return 0;
}
int hasEdge(int u, int v) {
	return hasEdge2(u,v);
	conto[max(u,v)]++;
	if(conto[max(u,v)]==max(u,v))return 1;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 10824 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 10824 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 10824 KB Output isn't correct
2 Halted 0 ms 0 KB -