Submission details
Task:Tourist's Journey
Sender:Andy_11
Submission time:2026-04-16 10:57:52 +0300
Language:C++ (C++17)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int32_t main()':
input/code.cpp:56:5: error: reference to 'visit' is ambiguous
   56 |     visit.assign(n + 1, 0);
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:80,
                 from input/code.cpp:1:
/usr/include/c++/13/variant:1851:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1851 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
input/code.cpp:37:4: note:                 'std::vector<long long int> visit'
   37 | vi visit;
      |    ^~~~~
input/code.cpp:64:5: error: reference to 'visit' is ambiguous
   64 |     visit[1] = 1;
      |     ^~~~~
/usr/include/c++/13/variant:1851:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit...

Code

#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast") 
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define double long double
#define vi vector<int>
#define pb push_back
#define vb vector<bool>
#define vs vector<string>
#define vpii vector<pii>
#define vvi vector<vi>
#define op ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(0);
#define umap unordered_map
#define umset unordered_multiset
#define uset unordered_set
#define mset multiset
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ers erase
#define pp pop_back
#define count_bits __builtin_popcount
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int oo = LLONG_MAX, cero = 0, moo = LLONG_MIN, ioo = INT_MAX;
const double PI = acos(-1);
const int mod = 1e9 + 7;
int lcm(int a, int b) {return a / __gcd(a, b) * b;}
//* AGUANTE MEGADETH *//
int ans = 0;
int n, m, k;
vvi g;
vi visit;
void dfs(int u, int prev, int c) 
{
    if (c == k) 
    {
        if (u == n) ans = (ans + 1) % mod;
        return;
    }
    for (int v : g[u]) 
    {
        if (v == prev) continue;
        dfs(v, u, c + 1);
    }
}

int32_t main()
{
    cin >> n >> m >> k;
    g.resize(n + 1);
    visit.assign(n + 1, 0);
    while (m--)
    {
        int a, b;
        cin >> a >> b;
        g[a].pb(b);
        g[b].pb(a);
    }
    visit[1] = 1;
    dfs(1, -1,0);
    cout << ans;
}