Submission #1195228

#TimeUsernameProblemLanguageResultExecution timeMemory
1195228yoavLConnecting Supertrees (IOI20_supertrees)C++20
11 / 100
112 ms22120 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();
    vvi g(n, vi(n, 0));
    rep(i, 0, n-1) g[i][i + 1] = g[i + 1][i] = p[i][i + 1];
    rep(s, 0, n) {
        int con = 1;
        rep(e, s+1, n) {
            con &= g[e-1][e];
            if (con != p[s][e]) 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


*/
#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...