Submission #395113

#TimeUsernameProblemLanguageResultExecution timeMemory
395113T0p_Connecting Supertrees (IOI20_supertrees)C++14
0 / 100
1 ms296 KiB
#include "supertrees.h" #include <bits/stdc++.h> using namespace std; int pa[2005]; int fp(int u) {return (u == pa[u]) ? u : pa[u] = fp(pa[u]);} int construct(vector<vector<int>> p) { int n = p.size(); for(int i=0 ; i<n+n ; i++) pa[i] = i; for(int i=0 ; i<n ; i++) for(int j=i+1 ; j<n ; j++) { if(p[i][j] == 3) return 0; else if(p[i][j]) { pa[fp(i)] = fp(j); pa[fp(i+n)] = fp(j+n); } else { pa[fp(i)] = fp(j+n); pa[fp(i+n)] = fp(j); } } for(int i=0 ; i<n ; i++) if(fp(i) == fp(i+n)) return 0; return 1; }
#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...