# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
300460 | mohammad | Connecting Supertrees (IOI20_supertrees) | C++14 | 299 ms | 22392 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
int root[1020] , de[1020] , use[1020] , r[1020];
ll find(int u){
if(root[u] == u) return u;
return root[u] = find(root[u]);
}
int construct(vector<vector<int>> p) {
int n = p.size();
vector<vector<int>> answer(n , vector<int>(n , 0));
for(int i = 0 ; i < n ; ++i){
if(p[i][i] != 1) return 0 ;
root[i] = i ;
}
for(int i = 0 ; i < n; ++i)
for(int j = 0 ; j < n; ++j){
if(p[i][j] == 2 || p[i][j] == 0) r[i]++ ;
if(!p[i][j]) continue ;
root[find(i)] = find(j);
}
for(int i = 0 ; i < n ; ++i) {
if(r[i] == n - 1) de[i] = 1;
else de[i] = 0 ;
find(i);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |