Submission #756158

# Submission time Handle Problem Language Result Execution time Memory
756158 2023-06-11T08:40:14 Z Trumling Connecting Supertrees (IOI20_supertrees) C++14
21 / 100
197 ms 27956 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 n;
bool dfs(int start,int beg)
{
	vis[start]=1;
	for(int i=0;i<n;i++)
		if(g[start][i]!=g[beg][i])
		return 0;
	
	for(int i=0;i<n;i++)
		if(!vis[i] && g[start][i])
		{
			ans[i][start]=1;
			ans[start][i]=1;
			return dfs(i,beg);
		}
			
	return 1;
}

int construct(vector<vector<int>> p) 
{
	n=p.size();
	g=p;

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

	for(int i=0;i<n;i++)
	{
		bool now=dfs(i,i);
		if(!now)
		return 0;
	}
	build(ans);
	return 1;

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 9 ms 1440 KB Output is correct
7 Correct 181 ms 27184 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 9 ms 1440 KB Output is correct
7 Correct 181 ms 27184 KB Output is correct
8 Correct 1 ms 324 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 8 ms 1364 KB Output is correct
13 Correct 181 ms 27324 KB Output is correct
14 Correct 1 ms 304 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 5 ms 980 KB Output is correct
17 Correct 82 ms 18032 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 47 ms 7156 KB Output is correct
21 Correct 170 ms 27904 KB Output is correct
22 Correct 176 ms 27888 KB Output is correct
23 Correct 179 ms 27852 KB Output is correct
24 Correct 172 ms 27888 KB Output is correct
25 Correct 72 ms 18036 KB Output is correct
26 Correct 78 ms 18032 KB Output is correct
27 Correct 197 ms 27852 KB Output is correct
28 Correct 170 ms 27956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Incorrect 1 ms 212 KB Answer gives possible 0 while actual possible 1
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Answer gives possible 0 while actual possible 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 9 ms 1440 KB Output is correct
7 Correct 181 ms 27184 KB Output is correct
8 Correct 1 ms 324 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 8 ms 1364 KB Output is correct
13 Correct 181 ms 27324 KB Output is correct
14 Correct 1 ms 304 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 5 ms 980 KB Output is correct
17 Correct 82 ms 18032 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 47 ms 7156 KB Output is correct
21 Correct 170 ms 27904 KB Output is correct
22 Correct 176 ms 27888 KB Output is correct
23 Correct 179 ms 27852 KB Output is correct
24 Correct 172 ms 27888 KB Output is correct
25 Correct 72 ms 18036 KB Output is correct
26 Correct 78 ms 18032 KB Output is correct
27 Correct 197 ms 27852 KB Output is correct
28 Correct 170 ms 27956 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 296 KB Output is correct
33 Incorrect 1 ms 212 KB Answer gives possible 0 while actual possible 1
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 9 ms 1440 KB Output is correct
7 Correct 181 ms 27184 KB Output is correct
8 Correct 1 ms 324 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 8 ms 1364 KB Output is correct
13 Correct 181 ms 27324 KB Output is correct
14 Correct 1 ms 304 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 5 ms 980 KB Output is correct
17 Correct 82 ms 18032 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 47 ms 7156 KB Output is correct
21 Correct 170 ms 27904 KB Output is correct
22 Correct 176 ms 27888 KB Output is correct
23 Correct 179 ms 27852 KB Output is correct
24 Correct 172 ms 27888 KB Output is correct
25 Correct 72 ms 18036 KB Output is correct
26 Correct 78 ms 18032 KB Output is correct
27 Correct 197 ms 27852 KB Output is correct
28 Correct 170 ms 27956 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 296 KB Output is correct
33 Incorrect 1 ms 212 KB Answer gives possible 0 while actual possible 1
34 Halted 0 ms 0 KB -