Submission #1301126

#TimeUsernameProblemLanguageResultExecution timeMemory
1301126sanoConnecting Supertrees (IOI20_supertrees)C++20
0 / 100
2 ms348 KiB
// Source: https://usaco.guide/general/io #include <iostream> // cin, cout #include <vector> // vector #include <string> // string #include <set> #include "supertrees.h" #define vec vector #define mod 1000000007 #define For(i,n) for(int i = 0; i < n; i++) using namespace std; int construct(vec<vec<int>>p){ int n = p.size(); vec<vec<int>> odp(n, vec<int>(n)); vec<set<int>> comp; vec<int> kde(n, -1); For(i, n){ int zakl = 0; if(kde[i] == -1){ set<int> s; s.insert(i); comp.push_back(s); kde[i] = comp.size() - 1; zakl = 1; } int poc = 0; For(j, n){ if(p[i][j] == 0) continue; poc++; if(kde[j] != kde[i]){ return 0; } if(kde[j] == -1){ if(zakl){ kde[j] = kde[i]; comp[kde[i]].insert(j); } else{ return 0; } } } } For(i, comp.size()){ vec<int> obsah; for(auto j : comp[i]){ obsah.push_back(j); } For(j, obsah.size() - 1){ odp[obsah[j]][obsah[j+1]] = 1; odp[obsah[j+1]][obsah[j]] = 1; } } build(odp); return 1; } /* int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); return 0; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...