# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
315991 | katearima | Connecting Supertrees (IOI20_supertrees) | C++14 | 261 ms | 22136 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 <vector>
#include <bits/stdc++.h>
using namespace std;
int i,j;
int construct(vector<vector<int> > p) {
int n = p.size();
vector<vector<int> > ans;
vector<int> v;
v.resize(n);
for (int i = 0; i < n; i++) {
ans.push_back(v);
}
for(i=0; i<n; i++){
for(j=0; j<n; j++){
if(p[i][j]==3) return 0;
//if(p[i][j]!=p[j][i]) return 0;
}
}
vector<int> z(n);
for(i=0;i<n; i++){
if(z[i]==1) continue;
for(j=0; j<n; j++){
if(p[i][j]>0){
if(z[j]==1) return 0;
z[j]=1;
}
}
}
vector <vector<int> > trees;
vector <vector<int> > cycles;
vector<int> f(n);
v.clear();
for(i=0; i<n; i++){
if(f[i]==1) continue;
for(j=0; j<n; j++){
if(p[i][j]==1) {
//if(f[j]==1) return 0;;
v.push_back(j);
f[j]=1;
}
}
for(int k=0; k<v.size()-1; k++){
int a=v[k]; int b=v[k+1];
ans[a][b]=ans[b][a]=1;
}
v.clear();
}
build(ans);
return 1;
}
Compilation message (stderr)
# | 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... |