Submission #921853

#TimeUsernameProblemLanguageResultExecution timeMemory
921853browntoadEscape Route (JOI21_escape_route)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "escape_route.h" #pragma GCC optimize ("Ofast", "unroll-loops") using namespace std; #define ll long long #define int ll #define FOR(i,a,b) for (int i = (a); i<(b); i++) #define REP(i,n) FOR(i,0,n) #define REP1(i,n) FOR(i,1,n+1) #define RREP(i,n) for (int i=(n)-1; i>=0; i--) #define RREP1(i,n) for (int i=(n); i>=1; i--) #define f first #define s second #define pb push_back #define ALL(x) x.begin(),x.end() #define SZ(x) (int)(x.size()) #define SQ(x) (x)*(x) #define pii pair<int, int> #define pip pair<int, pii> #define ppi pair<pii, int> #define pdd pair<double ,double> #define pcc pair<char, char> #define endl '\n' //#define TOAD #ifdef TOAD #define bug(x) cerr<<__LINE__<<": "<<#x<<" is "<<x<<endl #define IOS() #else #define bug(...) #define IOS() ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) #endif const ll inf = 1ll<<60; const int iinf=2147483647; const ll mod = 998244353; const ll maxn=505; const ll maxm=15; const double PI=acos(-1); ll pw(ll x, ll p, ll m=mod){ if (p < 0) return 0; ll ret=1; while (p>0){ if (p&1){ ret*=x; ret%=m; } x*=x; x%=m; p>>=1; } return ret; } ll inv(ll a, ll m=mod){ return pw(a,m-2,m); } int n, m, SS, q; struct edge{ int v; int l, c; // length, check }; vector<edge> g[maxn]; pii D(ppi U, edge E){ if (U.f.s + E.l > E.c){ U.f.f += SS-U.f.s; U.f.s = 0; U.f.f += E.l; U.f.s = E.l; } else { U.f.f += E.l; U.f.s += E.l; } return U.f; } std::vector<long long> calculate_necessary_time(int N, int M, long long S, int Q, std::vector<int> A, std::vector<int> B,std::vector<long long> L, std::vector<long long> C, std::vector<int> U,std::vector<int> V,std::vector<long long> T){ n = N; m = M; SS = S; q = Q; REP(i, m){ int u, v, a, b; u = A[i]; v = B[i]; a = L[i]; b = C[i]; g[u].pb({v, a, b}); g[v].pb({u, a, b}); } vector<int> ret; for (int z = 0; z < Q; z++){ int a, b, t; a = U[z]; b = V[z]; t = T[z]; priority_queue<ppi, vector<ppi>, greater<ppi> > pq; pq.push({{0, t}, a}); // mod and node vector<bool> occ(n+1); vector<pii> dis(n+1); pii ou = {inf, inf}; fill(ALL(dis), ou); dis[a] = {0, t}; pii tmp; while(SZ(pq)){ ppi tp = pq.top(); pq.pop(); if (occ[tp.s]) continue; occ[tp.s] = 1; for (auto y:g[tp.s]){ if (!occ[y.v]){ tmp = D(tp, y); if (tmp < dis[y.v]){ dis[y.v] = tmp; pq.push({dis[y.v], y.v}); } } } } ret.pb(dis[b].f); } return ret; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccynHruT.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