Submission #1129812

#TimeUsernameProblemLanguageResultExecution timeMemory
1129812alex_2008Crocodile's Underground City (IOI11_crocodile)C++20
0 / 100
1116 ms131684 KiB
#include "crocodile.h" #include <queue> #include <vector> #include <algorithm> typedef long long ll; using namespace std; const int N = 1e5 + 10; int visited[N]; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { vector <vector<pair<int, int>>> G(N); for (int i = 0; i < M; i++) { G[R[i][0]].push_back({ R[i][1], L[i] }); G[R[i][1]].push_back({ R[i][0], L[i] }); } priority_queue <pair<int, int>> PQ; for (int i = 0; i < K; i++) { visited[P[i]] = 1; PQ.push({ 0, P[i] }); } while (!PQ.empty()) { int d = -PQ.top().first, v = PQ.top().second; PQ.pop(); if (visited[v] == 2) continue; if (visited[v] == 0) { visited[v]++; continue; } if (v == 0) return d; for (auto it : G[v]) { PQ.push({ -(d + it.second), it.first }); } } }

Compilation message (stderr)

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...