Submission #1195244

#TimeUsernameProblemLanguageResultExecution timeMemory
1195244yoavLConnecting Supertrees (IOI20_supertrees)C++20
21 / 100
120 ms22184 KiB
#include "supertrees.h" #include <bits/stdc++.h> #define rep(i, s, e) for(int i = s; i < e; i++) #define pr(x) cout << x << endl #define wpr(x) cout << #x << "=" << x << endl using namespace std; using vi = vector<int>; using vvi = vector<vi>; using pi = pair<int, int>; using vpi = vector<pi>; using vvpi = vector<vpi>; template<class A> ostream &operator<<(ostream &os, const vector<A> &arr) { if (arr.empty()) { return os << "[]"; } os << "["; rep(i, 0, arr.size()) { os << arr[i] << ",]"[i == arr.size() - 1]; } return os; } template<class A, class B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << "{" << p.first << "," << p.second << "}"; } int construct(vector<vector<int> > p) { int n = p.size(); rep(i, 0, n) { assert(p[i][i] == 1); } vvi g(n, vi(n, 0)); vi color(n, -1); int cur_col = 0; rep(i, 0, n) { if (color[i] >= 0) continue; color[i] = cur_col++; rep(j, i+1, n) { if (p[i][j] >= 1) { color[j] = color[i]; g[i][j] = g[j][i] = 1; } } } rep(i, 0, n) { rep(j, 0, n) { if ((p[i][j] > 0) ^ (color[i] == color[j])) { return 0; } } } build(g); return 1; } /* 1 1 2 1 1 1 1 3 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 0 1 0 1 3 1 0 1 0 1 0 1 0 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...