# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1211500 | fafnir | Connecting Supertrees (IOI20_supertrees) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
// #define LOCAL
void build(vector<vector<int>> p) {
cout << 1 << '\n';
for (auto& row : p) {
for (auto& el : row) cout << el << ' ';
cout << '\n';
}
}
// p: requirements
// Return
// 0 --> Impossible to construct
// 1 --> Possible and make call to build
int construct(vector<vector<int>> p) {
const int n = p.size();
vector<vector<int>> answer(n, vector<int>(n, 0));
for (int i = 0; i < n-1; ++i) {
answer[i][i+1] = 1;
answer[i+1][i] = 1;
}
build(answer);
return 1;
}
#ifdef LOCAL
int32_t main(int argc, char** argv) {
assert (argc == 3);
freopen(argv[1], "r", stdin);
freopen(argv[2], "w", stdout);
vector<vector<int>> p;
int n;
cin >> n;
p.resize(n);
for (auto& e : p) {
vector<int> row;
for (auto& el : row) cin >> el;
e = row;
}
construct(p);
return 0;
}
#endif