제출 #1129818

#제출 시각아이디문제언어결과실행 시간메모리
1129818alex_2008악어의 지하 도시 (IOI11_crocodile)C++20
100 / 100
406 ms54996 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; visited[v]++; if (visited[v] == 1) { continue; } if (v == 0) return d; for (auto it : G[v]) { PQ.push({ -(d + it.second), it.first }); } } }

컴파일 시 표준 에러 (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...