Submission #1196333

#TimeUsernameProblemLanguageResultExecution timeMemory
1196333AMel0nCrocodile's Underground City (IOI11_crocodile)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define endl '\n' #define FOR(N) for(int i = 0; i < N; i++) #define VI vector<int> #define PII pair<int,int> #define F first #define S second #define all(x) (x).begin(), (x).end() signed main() { cin.tie(0); ios::sync_with_stdio(false); int N, M, K; cin >> N >> M >> K; VI E(N); vector<vector<PII>> adj(N, vector<PII>()); priority_queue<PII, vector<PII>, greater<>> pq; // second best dist because first best will be blocked, n vector<PII> vis(N, {LLONG_MAX, LLONG_MAX}); // best, second best vector<bool> seen(N, false); FOR(M) { int a, b, d; cin >> a >> b >> d; adj[a].push_back({b, d}); adj[b].push_back({a, d}); } FOR(K){ cin >> E[i]; vis[E[i]] = {0,0}; pq.push({0, E[i]}); } while(pq.size()){ int d = pq.top().F; int n = pq.top().S; pq.pop(); if (seen[n]) continue; seen[n] = true; //cout << d << ' ' << n << ' ' << vis[n].F << ' ' << vis[n].S << endl; for(auto c: adj[n]) { if (vis[c.F].F > d + c.S) { vis[c.F].S = vis[c.F].F; vis[c.F].F = d + c.S; } else if (vis[c.F].S > d + c.S) { vis[c.F].S = d + c.S; } if (vis[c.F].S != LLONG_MAX) pq.push({vis[c.F].S, c.F}); //cout << c.F << ' ' << vis[c.F].F << ' '<< vis[c.F].S << endl; } } cout << vis[0].S; return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccRsu9If.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc1HitYG.o:crocodile.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccRsu9If.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