Submission #300802

#TimeUsernameProblemLanguageResultExecution timeMemory
300802fpc_coderConnecting Supertrees (IOI20_supertrees)C++17
21 / 100
260 ms22268 KiB
#include <bits/stdc++.h> #include "supertrees.h" using namespace std; int construct(vector<vector<int>> p) { vector<vector<int>> b(p.size(), vector<int>(p.size(), 0)); int n = (int) p.size(); vector<int> par(n); for (int i = 0; i < n; i++) par[i] = i; for (int i = 0; i < n; i++) { for (int j = 0; j < i; j++) { if (p[i][j]) par[j] = i; } } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (par[i] == par[j] && p[i][j] == 0) return 0; if (par[i] != par[j] && p[i][j] == 1) return 0; } } for (int i = 0; i < n; i++) { if (par[i] != i) { b[i][par[i]] = 1; b[par[i]][i] = 1; } } build(b); 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...