31 const size_t n = routes.size();
33 const size_t height = 1 << n;
34 std::vector<std::vector<bool>>
dp(
height, std::vector<bool>(n,
false));
37 for (
size_t i = 0; i < n; ++i) {
40 for (
size_t i = 1; i <
height; i++) {
41 std::vector<size_t> zeros, ones;
43 for (
size_t pos = 0; pos < n; ++pos) {
51 for (
auto &o : ones) {
56 for (
auto &z : zeros) {
60 dp[i + (1 << z)][z] =
true;
65 bool is_cycle =
false;
66 for (
size_t i = 0; i < n; i++) {