답안 #756169

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
756169 2023-06-11T08:56:49 Z Trumling 슈퍼트리 잇기 (IOI20_supertrees) C++14
19 / 100
215 ms 27944 KB
#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std; 

typedef long long ll;
#define pb push_back
#define F first
#define S second
#define enter cout<<'\n';
#define INF 99999999999999999
#define MOD 1000000007
#define all(x) x.begin(),x.end()

vector<bool>vis(1000,0);
vector<vector<int>>g;
vector<vector<int>>ans;
ll nn;
bool dfs(int start,int beg)
{
	vis[start]=1;
	for(int i=0;i<nn;i++)
		if(g[start][i]!=g[beg][i] && i!=start && i!=beg)
			return 0;
		
		

	ll count=0;
	for(int i=0;i<nn;i++)
		if(g[start][i])
		count++;
	
	if(count==2)
	return 0;

	for(int i=0;i<nn;i++)
		if(!vis[i] && g[start][i])
		{
			ans[i][start]=1;
			ans[start][i]=1;
			return dfs(i,beg);
		}
	ans[start][beg]=1;
	ans[beg][start]=1;
	return 1;
}

int construct(vector<vector<int>> pr) 
{
	nn=pr.size();
	g=pr;

	ans.assign(nn,vector<int>(nn,0));

	for(int i=0;i<nn;i++)
	{
		bool now=dfs(i,i);
		if(!now)
		return 0;
	}
	for(int i=0;i<nn;i++)
	ans[i][i]=0;

	build(ans);
	return 1;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 8 ms 1432 KB Output is correct
9 Correct 184 ms 27892 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 9 ms 1420 KB Output is correct
13 Correct 194 ms 27920 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 7 ms 924 KB Output is correct
17 Correct 96 ms 17956 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 47 ms 7212 KB Output is correct
22 Correct 195 ms 27904 KB Output is correct
23 Correct 200 ms 27892 KB Output is correct
24 Correct 215 ms 27892 KB Output is correct
25 Correct 101 ms 17964 KB Output is correct
26 Correct 116 ms 18036 KB Output is correct
27 Correct 196 ms 27944 KB Output is correct
28 Correct 213 ms 27932 KB Output is correct
29 Correct 81 ms 18000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 1 ms 296 KB Too many ways to get from 1 to 4, should be 1 found no less than 2
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Answer gives possible 0 while actual possible 1
3 Halted 0 ms 0 KB -