# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
899168 | 2024-01-05T14:32:55 Z | oblantis | Connecting Supertrees (IOI20_supertrees) | C++17 | 0 ms | 0 KB |
//#include "supertrees.h" #include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define all(v) v.begin(), v.end() #define pb push_back #define ss second #define ff first #define vt vector using namespace std; //using namespace __gnu_pbds; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, int> pdi; const ll inf = 1e18; const int mod = 1e9+7; const int maxn = 1000 + 1; vector<int> g[maxn]; int x; int h[maxn]; bool was[maxn], used[maxn]; void dfs(int v){ h[v] = x; was[v] = 1; for(auto i : g[v]){ if(!was[i]){ dfs(i); } } } int construct(vector<vector<int>> p) { int n = p.size(); vector<vector<int>> ans(n); for(int i = 0; i < n; i++){ ans[i].resize(n); } for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(i == j){ if(!p[i][i])return 0; continue; } if(p[i][j]){ g[i].pb(j); } if(p[i][j] != p[j][i]){ return 0; } } } for(int i = 0; i < n; i++){ if(!was[i]){ x = i; dfs(i); } } for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(h[i] == h[j] && p[i][j] == 0){ return 0; } } } for(int i = 0; i < n; i++){ if(!used[i]){ int nxt = i; for(int j = 0; j < n; j++){ if(p[i][j] == 1){ } } } } build(ans); return 1; } void solve() { } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int times = 1; //cin >> times; for(int i = 1; i <= times; i++) { solve(); } return 0; }