제출 #1099126

#제출 시각아이디문제언어결과실행 시간메모리
1099126akamizane악어의 지하 도시 (IOI11_crocodile)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int,long long>; #define el cout << '\n' #define fi first #define se second #define pb push_back #define all(x) x.begin(), x.end() #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 REP(i, n) for (int i = 0; i < (n); i++) template <class T1, class T2>bool chmax(T1 &a, T2 b){if (a < b) {a = b; return true;}return false;} template <class T1, class T2>bool chmin(T1 &a, T2 b){if (a > b) {a = b; return true;}return false;} mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const ll mod = 1e9 + 7; const int maxn = 1e5 + 5; void solve(){ int n, m, k; cin >> n >> m >> k; vector<vector<pii>> ad(n); REP(i, m){ int u, v, w; cin >> u >> v >> w; ad[u].pb({v, w}); ad[v].pb({u, w}); } vector<vector<ll>> d(n, vector<ll> (2, 1e18)); using T = pair<long long, int>; priority_queue<T, vector<T>, greater<T>> pq; REP(i, k){ int p; cin >> p; d[p][0] = d[p][1] = 0; pq.push({0, p}); } while(pq.size()){ auto [val, u] = pq.top(); pq.pop(); if (val != d[u][1]) continue; for (auto [v, w] : ad[u]){ if (val + w < d[v][0]){ if (d[v][0] != d[v][1] && d[v][0] < 1e18){ d[v][1] = d[v][0]; pq.push({d[v][1], v}); } d[v][0] = val + w; } else if (val + w < d[v][1]){ d[v][1] = val + w; pq.push({d[v][1], v}); } } } cout << d[0][1]; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int tests = 1; // cin >> tests; for (int _ = 1; _ <= tests; _++){ cerr << "- Case #" << _ << ": \n"; solve(); el; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

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