#include <bits/stdc++.h> using namespace std; // przepraszam za formatowanie, prawdopodobnie najbrzydszy plik jaki kiedykolwiek wyslalem // kod zostal wygenerowany przy pomocy jupyter notebooka /* * * !pip install treegen import treegen import networkx as nx import numpy def max_matching(n, tree): graf = nx.from_numpy_matrix(numpy.array(tree)) return len(nx.max_weight_matching(graf)) * * results = numpy.zeros([10, 10], dtype=int) print(results) * * def create_matrix(r): results = numpy.zeros([r + 1, r + 1], dtype=int) for i in range(r + 1): results[1][i] += 1 for n in range(1, 2 * r + 1): trees = treegen.generate_trees_adjacency_matrix(n_vertices = n) for tree in trees: indep = n - max_matching(n, tree) for L in range(1, r + 1): for R in range(L, r + 1): if L <= indep and indep <= R: results[L][R] += 1 * * * * * * * * * */ vector <vector <int> > answers = { { 0, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, { 1 , 2 , 4 , 9 , 24 , 76 , 279 , 1159 ,5227 , 25073, 125597}, { 0 , 0 , 2 , 7, 22 , 74 , 277 , 1157 ,5225, 25071, 125595}, { 0 , 0 , 0 , 5 , 20 , 72 , 275, 1155 , 5223, 25069, 125593}, { 0 , 0 , 0 , 0 , 15 , 67 , 270 , 1150 , 5218 , 25064, 125588}, { 0 , 0 , 0 , 0 , 0 , 52 , 255 , 1135 , 5203 , 25049, 125573}, { 0 , 0 , 0 , 0 , 0 , 0, 203 , 1083, 5151, 24997, 125521}, { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 880 , 4948 ,24794, 125318}, { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4068, 23914, 124438}, { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 19846, 120370}, { 0, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 100524}}; int main() { int l, r, c; cin >> l >> r >> c; cout << answers[l][r] << endl; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | #include <bits/stdc++.h> using namespace std; // przepraszam za formatowanie, prawdopodobnie najbrzydszy plik jaki kiedykolwiek wyslalem // kod zostal wygenerowany przy pomocy jupyter notebooka /* * * !pip install treegen import treegen import networkx as nx import numpy def max_matching(n, tree): graf = nx.from_numpy_matrix(numpy.array(tree)) return len(nx.max_weight_matching(graf)) * * results = numpy.zeros([10, 10], dtype=int) print(results) * * def create_matrix(r): results = numpy.zeros([r + 1, r + 1], dtype=int) for i in range(r + 1): results[1][i] += 1 for n in range(1, 2 * r + 1): trees = treegen.generate_trees_adjacency_matrix(n_vertices = n) for tree in trees: indep = n - max_matching(n, tree) for L in range(1, r + 1): for R in range(L, r + 1): if L <= indep and indep <= R: results[L][R] += 1 * * * * * * * * * */ vector <vector <int> > answers = { { 0, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0}, { 1 , 2 , 4 , 9 , 24 , 76 , 279 , 1159 ,5227 , 25073, 125597}, { 0 , 0 , 2 , 7, 22 , 74 , 277 , 1157 ,5225, 25071, 125595}, { 0 , 0 , 0 , 5 , 20 , 72 , 275, 1155 , 5223, 25069, 125593}, { 0 , 0 , 0 , 0 , 15 , 67 , 270 , 1150 , 5218 , 25064, 125588}, { 0 , 0 , 0 , 0 , 0 , 52 , 255 , 1135 , 5203 , 25049, 125573}, { 0 , 0 , 0 , 0 , 0 , 0, 203 , 1083, 5151, 24997, 125521}, { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 880 , 4948 ,24794, 125318}, { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4068, 23914, 124438}, { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 19846, 120370}, { 0, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 100524}}; int main() { int l, r, c; cin >> l >> r >> c; cout << answers[l][r] << endl; } |