Submission #722037

#TimeUsernameProblemLanguageResultExecution timeMemory
722037ZflopCrocodile's Underground City (IOI11_crocodile)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using str = string; // yay python! using ld = long double; // or double, if TL is tight using ll = long long; using int64 = ll; using db = double; using ull = unsigned long long; #define ch() getchar() #define pc(x) putchar(x) #define tcT template<class T #define tcTU tcT, class U tcT> using V = vector<T>; tcT, size_t SZ> using AR = array<T,SZ>; using vi = V<int>; using vb = V<bool>; using vpi = V<pair<int,int>>; using vvi = V<vi>; using vl = V<ll>; using vd = V<ld>; using vstr = V<str>; // pairs #define mp make_pair #define pi pair <int, int> #define f first #define s second // loops #define F0R(i, a, b) for (int i=a; i<b;++i) #define FOR(i, a) for (int i=0; i<a;++i) #define FORn(i, a) for (int i=1; i<=a;++i) #define ROF(i,a) for(int i=a-1; i >= 0;--i) #define R0F(i,a,b) for(int i=a; i > b;--i) #define ROFn(i,a) for(int i=a; i > 0;--i) #define rep(a) F0R(_, a) #define trav(i,x) for(auto& i:x) // vectors #define lb lower_bound #define ub upper_bound #define SUM(v) accumulate(all(v), 0LL) #define MN(v) *min_element(all(v)) #define MX(v) *max_element(all(v)) #define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end()) #define eb emplace_back #define ft front() #define bk back() #define ins insert #define pf push_front #define pb push_back #define emt empty() #define rsz resize #define all(x) begin(x), end(x) #define sor(x) sort(all(x)) #define rev(x) reverse(all(x)) #define sz(x) (int)(x).size() #define rall(x) x.rbegin(), x.rend() #define AR array const ll inf = (ll)1e14; int travel_plan(int N, int M, int K,int in[][2], int tm[], int r[]){ V<vpi> A(N + 1); FOR(i,M){ int a = in[i][0]; int b = in[i][1]; int c = tm[i]; A[a].pb({b,c}); A[b].pb({a,c}); } auto djs = [&] (){ V<pair<ll,ll>> cost(N,{inf,inf}); priority_queue<vl,V<vl>,greater<vl>>pq; FOR(i,K){ cost[r[i]] = {0,0}; pq.push({0,0,r[i]}); } while(sz(pq)){ auto node = pq.top(); ll a = node[0]; ll b = node[1]; ll c = node[2]; pq.pop(); if(cost[c].f < a || a == inf) continue; if(cost[c].f == a && cost[c].s < b) continue; trav(x,A[c]) if(cost[x.f].s > a + x.s){ cost[x.f].f = cost[x.f].s; cost[x.f].s = a + x.s; pq.push({cost[x.f].f,cost[x.f].s,x.f}); } else if(cost[x.f].f > a + x.s){ cost[x.f].f = a + x.s; pq.push({cost[x.f].f,cost[x.f].s,x.f}); } } return cost[0].f; }; return djs(); }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccooCfhv.o: in function `main':
grader.cpp:(.text.startup+0x36): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status