Submission #456170

# Submission time Handle Problem Language Result Execution time Memory
456170 2021-08-06T07:52:48 Z Khizri Connecting Supertrees (IOI20_supertrees) C++17
0 / 100
1 ms 204 KB
#include "supertrees.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
#define ll long long
#define pb push_back		 
#define F first																 
#define S second 															 
#define INF 1e18
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define OK cout<<"Ok"<<endl;
#define MOD (ll)(1e9+7)
vector<std::vector<int>> ans;
vector<std::vector<int>>arr;
int color[1005],n;
bool qq=false;
void dfs(int u,int p){
	color[u]=1;
	for(int i=0;i<n;i++){
		if(arr[u][i]==1&&!color[i]){
			ans[u][i]=1;
			ans[i][u]=1;
			dfs(i,u);
		}
		if(arr[u][i]==1&&color[i]==1){
			qq=true;
			return;
		}
	}
}
int construct(std::vector<std::vector<int>> p) {
	arr=p;
	n = arr.size();
	for (int i = 0; i < n; i++) {
		std::vector<int> row;
		row.resize(n);
		ans.push_back(row);
	}
	for(int i=0;i<n;i++){
		if(!color[i]){
			dfs(i,-1);
		}
	}
	if(qq){
		return 0;
	}
	build(ans);
	return 1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Answer gives possible 0 while actual possible 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 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 204 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 204 KB Answer gives possible 0 while actual possible 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Answer gives possible 0 while actual possible 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Answer gives possible 0 while actual possible 1
2 Halted 0 ms 0 KB -