제출 #1014997

#제출 시각아이디문제언어결과실행 시간메모리
1014997elpro123Connecting Supertrees (IOI20_supertrees)C++14
21 / 100
118 ms24148 KiB
#include<bits/stdc++.h> #include "supertrees.h" #include <vector> using namespace std; int par[10000]; int Find(int a){ if(par[a]==a){ return a; } par[a] = Find(par[a]); return par[a]; } void Union(int a, int b){ par[Find(a)] = Find(b); } int construct(vector<vector<int>> p){ int n = p.size(); for(int i=0; i<n; i++){ par[i] = i; } vector<vector<int>> adj(n, vector<int>(n, 0)); for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ if(p[i][j] && Find(i)!=Find(j)){ Union(i, j); adj[i][j] = 1; adj[j][i] = 1; } else if(!p[i][j] && Find(i)==Find(j)){ return 0; } } } build(adj); 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...