Submission #1258922

#TimeUsernameProblemLanguageResultExecution timeMemory
1258922khoile08Crocodile's Underground City (IOI11_crocodile)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define FOR(i,a,b) for(int i = a; i <= b; i++) #define FOD(i,a,b) for(int i = a; i >= b; i--) //#define int long long #define fi first #define se second #define pb push_back #define ll long long #define ull unsigned long long #define db double #define lcm(a,b) a / __gcd(a, b) * b #define ii pair<int,int> #define iii pair<int,pair<int,int>> #define iv pair<pair<int,int>,pair<int,int>> #define sq(a) (a) * (a) #define MASK(i) (1LL << i) #define task "task" const int inf = 2e9; const ll INF = 1e18; const int mod = 1e9 + 7; const int N = 1e5 + 5; const int M = 1e6 + 5; int n, m, k; int R[M][2], L[M], P[N]; ll d[2][N]; vector<ii> g[N]; int travel_plan(int n, int m, int R[][2], int L[], int k, int P[]) { priority_queue<ii,vector<ii>,greater<ii>> pq; FOR(i, 0, n - 1) d[0][i] = d[1][i] = INF; FOR(i, 0, m - 1) { g[R[i][0]].pb({R[i][1], L[i]}); g[R[i][1]].pb({R[i][0], L[i]}); } FOR(i, 0, k - 1) { d[0][P[i]] = d[1][P[i]] = 0; pq.push({0, P[i]}); } while(!pq.empty()) { int cost = pq.top().fi; int u = pq.top().se; pq.pop(); if(cost != d[1][u]) continue; for(auto H : g[u]) { int v = H.fi; int w = H.se; if(d[0][v] == cost + w && d[0][v] < d[1][v]) { d[1][v] = d[0][v]; pq.push({d[1][v], v}); } if(d[0][v] > cost + w) { if(d[0][v] < d[1][v]) pq.push({d[0][v], v}); d[1][v] = d[0][v]; d[0][v] = cost + w; } else if(d[1][v] > cost + w) { d[1][v] = cost + w; pq.push({d[1][v], v}); } } } return d[1][0]; } int main() { // if(fopen(task".inp", "r")) { // freopen(task".inp", "r", stdin); // freopen(task".out", "w", stdout); // } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m >> k; FOR(i, 0, m - 1) cin >> R[i][0] >> R[i][1] >> L[i]; FOR(i, 0, k - 1) cin >> P[i]; cout << travel_plan(n, m, R, L, k, P) << '\n'; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cc7G3PlB.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc4AbMjx.o:crocodile.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status