Submission #305696

# Submission time Handle Problem Language Result Execution time Memory
305696 2020-09-23T19:56:22 Z a_player Connecting Supertrees (IOI20_supertrees) C++14
0 / 100
1 ms 256 KB
#include "supertrees.h"
#include <bits/stdc++.h>

using namespace std;

const int nax=1e3+3;
int alt[nax];
int link[nax];
int find(int a){
	if(link[a]==a)return a;
	return link[a]=find(link[a]);
}
void unite(int a,int b){
	int x=find(a);
	int y=find(b);
	if(x==y)return;
	if(alt[x]>alt[y])link[y]=x;
	else{
		link[x]=y;
		if(alt[x]==alt[y])alt[y]++;
	}
}
bool same(int a, int b){
	return find(a)==find(b);
}
int construct(std::vector<std::vector<int>> p){
	int n=p.size();
	vector<vector<int>> b(n,vector<int>(n));
	for(int i=0;i<n;i++)
	for(int j=i+1;j<n;j++){
		if(p[i][j]==1&&!same(i,j)){
			unite(i,j);
			b[i][j]=1;
			b[j][i]=1;
	}
}
for(int i=0;i<n;i++)
for(int j=i+1;j<n;j++)if(same(i,j)&&p[i][j]==0)return 0;
build(b);
	return 1;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Too few ways to get from 0 to 1, should be 1 found 0
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Too few ways to get from 0 to 1, should be 1 found 0
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Answer gives possible 0 while actual possible 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Answer gives possible 0 while actual possible 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Too few ways to get from 0 to 1, should be 1 found 0
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Too few ways to get from 0 to 1, should be 1 found 0
3 Halted 0 ms 0 KB -