Submission #424575

# Submission time Handle Problem Language Result Execution time Memory
424575 2021-06-12T06:30:27 Z berrygarlic Connecting Supertrees (IOI20_supertrees) C++14
21 / 100
270 ms 27080 KB
#include <bits/stdc++.h>
#include "supertrees.h"
using namespace std;

int construct(vector<vector<int> > p){
	int n = p.size();
	vector<vector<int> > b(n,vector<int>(n)),t(n,vector<int>(n));
	bool vis[n];
	memset(vis,false,sizeof(vis));
	for(int i=0;i<n;i++){
		if(vis[i]) continue;
		vector<int> line;
		for(int j=0;j<n;j++){
			if(p[i][j] == 1){
				line.push_back(j);
			}
		}
		for(int j=0;j<line.size();j++){
			if(vis[line[j]]){
				return 0;
			}
			vis[line[j]] = true;
			for(int k=0;k<line.size();k++){
				if(p[line[j]][line[k]] != 1){
					return 0;
				}
				t[line[j]][line[k]] = true;
			}
		}
		for(int j=1;j<line.size();j++){
			b[line[j]][line[j-1]] = b[line[j-1]][line[j]] = true;
		}
	}
	if(p != t) return 0;
	build(b);
	return 1;
}

Compilation message

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:18:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for(int j=0;j<line.size();j++){
      |               ~^~~~~~~~~~~~
supertrees.cpp:23:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |    for(int k=0;k<line.size();k++){
      |                ~^~~~~~~~~~~~
supertrees.cpp:30:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   for(int j=1;j<line.size();j++){
      |               ~^~~~~~~~~~~~
# 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 1 ms 204 KB Output is correct
6 Correct 11 ms 1328 KB Output is correct
7 Correct 270 ms 25980 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 1 ms 204 KB Output is correct
6 Correct 11 ms 1328 KB Output is correct
7 Correct 270 ms 25980 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 23 ms 1336 KB Output is correct
13 Correct 231 ms 25992 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 5 ms 844 KB Output is correct
17 Correct 104 ms 15992 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 60 ms 6704 KB Output is correct
21 Correct 223 ms 25924 KB Output is correct
22 Correct 222 ms 25992 KB Output is correct
23 Correct 245 ms 25928 KB Output is correct
24 Correct 227 ms 25896 KB Output is correct
25 Correct 101 ms 16008 KB Output is correct
26 Correct 97 ms 17968 KB Output is correct
27 Correct 270 ms 27080 KB Output is correct
28 Correct 256 ms 27076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 Correct 0 ms 204 KB Output is correct
5 Incorrect 1 ms 204 KB Answer gives possible 0 while actual possible 1
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Answer gives possible 0 while actual possible 1
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 1 ms 204 KB Output is correct
6 Correct 11 ms 1328 KB Output is correct
7 Correct 270 ms 25980 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 23 ms 1336 KB Output is correct
13 Correct 231 ms 25992 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 5 ms 844 KB Output is correct
17 Correct 104 ms 15992 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 60 ms 6704 KB Output is correct
21 Correct 223 ms 25924 KB Output is correct
22 Correct 222 ms 25992 KB Output is correct
23 Correct 245 ms 25928 KB Output is correct
24 Correct 227 ms 25896 KB Output is correct
25 Correct 101 ms 16008 KB Output is correct
26 Correct 97 ms 17968 KB Output is correct
27 Correct 270 ms 27080 KB Output is correct
28 Correct 256 ms 27076 KB Output is correct
29 Correct 1 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 Correct 0 ms 204 KB Output is correct
33 Incorrect 1 ms 204 KB Answer gives possible 0 while actual possible 1
34 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 1 ms 204 KB Output is correct
6 Correct 11 ms 1328 KB Output is correct
7 Correct 270 ms 25980 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 23 ms 1336 KB Output is correct
13 Correct 231 ms 25992 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 5 ms 844 KB Output is correct
17 Correct 104 ms 15992 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 60 ms 6704 KB Output is correct
21 Correct 223 ms 25924 KB Output is correct
22 Correct 222 ms 25992 KB Output is correct
23 Correct 245 ms 25928 KB Output is correct
24 Correct 227 ms 25896 KB Output is correct
25 Correct 101 ms 16008 KB Output is correct
26 Correct 97 ms 17968 KB Output is correct
27 Correct 270 ms 27080 KB Output is correct
28 Correct 256 ms 27076 KB Output is correct
29 Correct 1 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 Correct 0 ms 204 KB Output is correct
33 Incorrect 1 ms 204 KB Answer gives possible 0 while actual possible 1
34 Halted 0 ms 0 KB -