제출 #395113

#제출 시각아이디문제언어결과실행 시간메모리
395113T0p_슈퍼트리 잇기 (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...