Submission #1014997

# Submission time Handle Problem Language Result Execution time Memory
1014997 2024-07-05T22:29:46 Z elpro123 Connecting Supertrees (IOI20_supertrees) C++14
21 / 100
118 ms 24148 KB
#include<bits/stdc++.h>
#include "supertrees.h"
#include <vector>
using namespace std;
 
int par[10000];
int Find(int a){
	if(par[a]==a){
		return a;
	}
	par[a] = Find(par[a]);
	return par[a];
}
 
void Union(int a, int b){
	par[Find(a)] = Find(b);
}
 
int construct(vector<vector<int>> p){
	int n = p.size();
	for(int i=0; i<n; i++){
		par[i] = i;
	}
	vector<vector<int>> adj(n, vector<int>(n, 0));
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			if(p[i][j] && Find(i)!=Find(j)){
				Union(i, j);
				adj[i][j] = 1;
				adj[j][i] = 1;
			}
			else if(!p[i][j] && Find(i)==Find(j)){
				return 0;
			}
		}
	}
	build(adj);
	return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 440 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 5 ms 1372 KB Output is correct
7 Correct 101 ms 24080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 440 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 5 ms 1372 KB Output is correct
7 Correct 101 ms 24080 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 440 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 4 ms 1396 KB Output is correct
13 Correct 104 ms 24124 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 2 ms 860 KB Output is correct
17 Correct 51 ms 13996 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 26 ms 6268 KB Output is correct
21 Correct 106 ms 24144 KB Output is correct
22 Correct 105 ms 24148 KB Output is correct
23 Correct 109 ms 24144 KB Output is correct
24 Correct 107 ms 24080 KB Output is correct
25 Correct 50 ms 14160 KB Output is correct
26 Correct 52 ms 14160 KB Output is correct
27 Correct 118 ms 24148 KB Output is correct
28 Correct 112 ms 24148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 0 ms 388 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 440 KB Output is correct
2 Incorrect 0 ms 344 KB Too few ways to get from 0 to 1, should be 2 found 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 440 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 5 ms 1372 KB Output is correct
7 Correct 101 ms 24080 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 440 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 4 ms 1396 KB Output is correct
13 Correct 104 ms 24124 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 2 ms 860 KB Output is correct
17 Correct 51 ms 13996 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 26 ms 6268 KB Output is correct
21 Correct 106 ms 24144 KB Output is correct
22 Correct 105 ms 24148 KB Output is correct
23 Correct 109 ms 24144 KB Output is correct
24 Correct 107 ms 24080 KB Output is correct
25 Correct 50 ms 14160 KB Output is correct
26 Correct 52 ms 14160 KB Output is correct
27 Correct 118 ms 24148 KB Output is correct
28 Correct 112 ms 24148 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Incorrect 0 ms 388 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 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 440 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 5 ms 1372 KB Output is correct
7 Correct 101 ms 24080 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 440 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 4 ms 1396 KB Output is correct
13 Correct 104 ms 24124 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 2 ms 860 KB Output is correct
17 Correct 51 ms 13996 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 26 ms 6268 KB Output is correct
21 Correct 106 ms 24144 KB Output is correct
22 Correct 105 ms 24148 KB Output is correct
23 Correct 109 ms 24144 KB Output is correct
24 Correct 107 ms 24080 KB Output is correct
25 Correct 50 ms 14160 KB Output is correct
26 Correct 52 ms 14160 KB Output is correct
27 Correct 118 ms 24148 KB Output is correct
28 Correct 112 ms 24148 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Incorrect 0 ms 388 KB Answer gives possible 1 while actual possible 0
33 Halted 0 ms 0 KB -