Submission #876020

# Submission time Handle Problem Language Result Execution time Memory
876020 2023-11-21T05:39:57 Z Regulus Escape Route (JOI21_escape_route) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>            // pA
#include "escape_route.h"
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define debug(x) cerr << #x << " = " << (x) << ' '
#define endl cerr << '\n'
#define all(v) (v).begin(), (v).end()
#define lowbit(x) (x)&-(x)
#define pb emplace_back
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using ppl = pair<pll, ll>;

const int N = 2e5+5;
const int INF = 2e9;
pll dis[N];
vector<ll> ans;
vector<pll> g[N];
priority_queue<ppl, vector<ppl>, greater<ppl> > pq;

vector<ll> calculate_necessary_time(int n, int m, ll s, int Q, vector<int> A, vector<int> B,
    vector<int> L, vector<int> C, vector<int> U, vector<int> V, vector<int> T)
{
    int i, j;

    for (i=0; i < m; ++i) g[A[i]].pb(B[i], i), g[B[i]].pb(A[i], i);
    
    for (int t=0; t < Q; ++t)
    {
        while (!pq.empty()) pq.pop();
        for (i=0; i < n; ++i) dis[i] = {INF, INF};
        dis[U[t]] = {0, 0}, pq.push({pll{0, 0}, U[t]});
        while (!pq.empty())
        {
            int x = pq.top().S;
            pq.pop();
            for (auto p : g[x])
            {
                ll v = p.F, id = p.S;
                pll tmp = dis[x];
                tmp.S += L[p.S];
                if (tmp.S > C[id]) ++tmp.F, tmp.S = 0;
                if (tmp < dis[v])
                {
                    dis[v] = tmp, pq.push({dis[v], v});
                }
            }
        }
        ans.pb(dis[V[t]].F*s + dis[V[t]].S);
    }

    return ans;
}

Compilation message

escape_route.cpp: In function 'std::vector<long long int> calculate_necessary_time(int, int, ll, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
escape_route.cpp:26:12: warning: unused variable 'j' [-Wunused-variable]
   26 |     int i, j;
      |            ^
/usr/bin/ld: /tmp/ccpNEmds.o: in function `main':
grader.cpp:(.text.startup+0x6ea): undefined reference to `calculate_necessary_time(int, int, long long, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<long long, std::allocator<long long> >, std::vector<long long, std::allocator<long long> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<long long, std::allocator<long long> >)'
collect2: error: ld returned 1 exit status