Submission #372849

#TimeUsernameProblemLanguageResultExecution timeMemory
372849ntabc05101악어의 지하 도시 (IOI11_crocodile)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define f first #define s second const int64_t inf = 1e17; const int max_n = 100000; const int max_m = 100000; struct Edge { int x, y, w; }; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m, k; cin >> n >> m >> k; Edge edges[m]; for (int i = 0; i < m; i++) { cin >> edges[i].x >> edges[i].y; //edges[i].x--; //edges[i].y--; } for (int i = 0; i < m; i++) { cin >> edges[i].w; } vector< pair<int, int> > adjList[n]; for (int i = 0; i < m; i++) { adjList[edges[i].x].push_back({edges[i].y, edges[i].w}); adjList[edges[i].y].push_back({edges[i].x, edges[i].w}); } priority_queue< pair<int64_t, int> > pq; int64_t dist[n]; vector<int64_t> distList[n]; for (int i = 0; i < n; i++) { dist[i] = inf; } while (k--) { int u; cin >> u; //u--; distList[u].push_back(0); pq.push({-0, u}); } while (!pq.empty()) { int64_t cdist = -pq.top().first; int cvertex = pq.top().second; //cout << cdist << " " << cvertex << "\n"; pq.pop(); if (distList[cvertex].size() > 1) continue; distList[cvertex].push_back(cdist); if (distList[cvertex].size() == 2) { for (auto& to: adjList[cvertex]) { pq.push({-(cdist+to.s), to.f}); } } } cout << distList[0][1] << "\n"; return 0; } /* 5 4 3 0 1 0 2 3 2 2 4 2 3 1 4 1 3 4 */ /* 5 7 2 0 2 0 3 3 2 2 1 0 1 0 4 3 4 4 3 2 10 100 7 9 1 3 */

Compilation message (stderr)

crocodile.cpp: In function 'int main()':
crocodile.cpp:37:17: warning: variable 'dist' set but not used [-Wunused-but-set-variable]
   37 |         int64_t dist[n];
      |                 ^~~~
/tmp/ccPC6sYa.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cctZlMrO.o:crocodile.cpp:(.text.startup+0x0): first defined here
/tmp/ccPC6sYa.o: In function `main':
grader.cpp:(.text.startup+0x32): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status