Submission #1322219

#TimeUsernameProblemLanguageResultExecution timeMemory
1322219norrawichzzzConstruction Project 2 (JOI24_ho_t2)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi pair<int,int>

const int INF = 4e18;

int32_t main() {
    cin.tie(0)->sync_with_stdio(0);
    int n,m;
    cin>> n>> m;

    int s,t,l,k;
    cin>> s>> t>> l>> k;

    vector<vector<pair<int,int>>> g(n+1);
    for (int i=0; i<m; i++) {
        int u,v,w;
        cin>> u>> v>> w;

        g[u].push_back({v,w});
        g[v].push_back({u,w});
    }

    vector<int> dist(n+1, INF), rdist(n+1, INF);
    dist[s] = 0;
    rdist[t] = 0;

    priority_queue<pi, vector<pi>, greater<pi>> pq;
    pq.push({0, s});

    while (!pq.empty()) {
        int u=pq.top().second, d=pq.top().first;
        pq.pop();

        if (dist[u] < d) continue;

        for (auto &x : g[u]) {
            int v=x.first, w=x.second;

            if (dist[v] > dist[u]+w) {
                dist[v] = dist[u]+w;
                pq.push({dist[v], v});
            }
        }
    }

    pq.push({0, t});
    while (!pq.empty()) {
        int u=pq.top().second, d=pq.top().first;
        pq.pop();

        if (rdist[u] < d) continue;

        for (auto &x : g[u]) {
            int v=x.first, w=x.second;

            if (rdist[v] > rdist[u]+w) {
                rdist[v] = rdist[u]+w;
                pq.push({rdist[v], v});
            }
        }
    }

    int ans = 0;
    for (int i=1; i<=n; i++) {
        for (int j=i+1; j<=n; j++) {
            if (dist[i] + l + rdist[j] <= k) ans++; 
            else if (rdist[i] + l + dist[j] <= k) ans++;
            else if (dist[e]<=k || rdist[s] <= k) ans++;
        }
    }
    cout<< ans;
    
}

Compilation message (stderr)

Main.cpp: In function 'int32_t main()':
Main.cpp:70:27: error: 'e' was not declared in this scope; did you mean 'std::numbers::e'?
   70 |             else if (dist[e]<=k || rdist[s] <= k) ans++;
      |                           ^
      |                           std::numbers::e
In file included from /usr/include/c++/13/bits/max_size_type.h:37,
                 from /usr/include/c++/13/bits/ranges_base.h:39,
                 from /usr/include/c++/13/bits/ranges_algobase.h:38,
                 from /usr/include/c++/13/bits/ranges_algo.h:38,
                 from /usr/include/c++/13/algorithm:63,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from Main.cpp:1:
/usr/include/c++/13/numbers:122:27: note: 'std::numbers::e' declared here
  122 |   inline constexpr double e = e_v<double>;
      |                           ^