Submission #421237

# Submission time Handle Problem Language Result Execution time Memory
421237 2021-06-08T22:34:12 Z JUANDI321 Connecting Supertrees (IOI20_supertrees) C++17
21 / 100
752 ms 22852 KB
#include "supertrees.h"
#include <vector>
#include <deque>

using namespace std;
bool ch[1010];

int construct(vector<vector<int>> p) {
	int n = p.size();
	vector<vector<int>> answer;
	for (int i = 0; i < n; i++) 
	{
		vector<int> row;
		row.resize(n);
		answer.push_back(row);
	}
	for(int i = 0; i<n; i++)
	{
		for(int j = i+1; j<n; j++)
		{
			if(p[i][j] == 0)
			{
				for(int h = 0; h < n; h++)
				{
					if(p[i][h] == 1 && p[j][h] == 1)return 0;
				}
			}
		}
	}
	deque<int> l;
	for(int i = 0; i<n; i++)
	{
		if(!ch[i])
		{
			ch[i]=true;
			//l.clear();
			int ant = i;
			for(int j = 0; j<n; j++)
			{
				if(p[i][j] == 1 && i != j)
				{
					ch[j]=true;
					answer[ant][j]=1;
					answer[j][ant]=1;
					ant = j;
				}
			}
		}
	}
	build(answer);
	return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 10 ms 1100 KB Output is correct
7 Correct 236 ms 22000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 10 ms 1100 KB Output is correct
7 Correct 236 ms 22000 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 276 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 14 ms 1216 KB Output is correct
13 Correct 490 ms 22852 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 280 KB Output is correct
16 Correct 5 ms 820 KB Output is correct
17 Correct 116 ms 12752 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 111 ms 6240 KB Output is correct
21 Correct 752 ms 22612 KB Output is correct
22 Correct 541 ms 22720 KB Output is correct
23 Correct 599 ms 22680 KB Output is correct
24 Correct 503 ms 22628 KB Output is correct
25 Correct 118 ms 12772 KB Output is correct
26 Correct 146 ms 12668 KB Output is correct
27 Correct 601 ms 22592 KB Output is correct
28 Correct 502 ms 22744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 1 ms 280 KB Answer gives possible 1 while actual possible 0
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Too few ways to get from 0 to 1, should be 2 found 0
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 10 ms 1100 KB Output is correct
7 Correct 236 ms 22000 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 276 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 14 ms 1216 KB Output is correct
13 Correct 490 ms 22852 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 280 KB Output is correct
16 Correct 5 ms 820 KB Output is correct
17 Correct 116 ms 12752 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 111 ms 6240 KB Output is correct
21 Correct 752 ms 22612 KB Output is correct
22 Correct 541 ms 22720 KB Output is correct
23 Correct 599 ms 22680 KB Output is correct
24 Correct 503 ms 22628 KB Output is correct
25 Correct 118 ms 12772 KB Output is correct
26 Correct 146 ms 12668 KB Output is correct
27 Correct 601 ms 22592 KB Output is correct
28 Correct 502 ms 22744 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Incorrect 1 ms 280 KB Answer gives possible 1 while actual possible 0
33 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 10 ms 1100 KB Output is correct
7 Correct 236 ms 22000 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 276 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 14 ms 1216 KB Output is correct
13 Correct 490 ms 22852 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 280 KB Output is correct
16 Correct 5 ms 820 KB Output is correct
17 Correct 116 ms 12752 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 111 ms 6240 KB Output is correct
21 Correct 752 ms 22612 KB Output is correct
22 Correct 541 ms 22720 KB Output is correct
23 Correct 599 ms 22680 KB Output is correct
24 Correct 503 ms 22628 KB Output is correct
25 Correct 118 ms 12772 KB Output is correct
26 Correct 146 ms 12668 KB Output is correct
27 Correct 601 ms 22592 KB Output is correct
28 Correct 502 ms 22744 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Incorrect 1 ms 280 KB Answer gives possible 1 while actual possible 0
33 Halted 0 ms 0 KB -