제출 #465521

#제출 시각아이디문제언어결과실행 시간메모리
465521MohamedFaresNebili악어의 지하 도시 (IOI11_crocodile)C++14
100 / 100
543 ms66872 KiB
#include <bits/stdc++.h> #include "crocodile.h" using namespace std; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { vector<pair<int, int>>adj[N]; vector<int> d(N, 0); priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>pq; for(int l=0;l<M;l++) { int a=R[l][0], b=R[l][1], w=L[l]; adj[a].push_back({b, w}); adj[b].push_back({a, w}); } for(int l=0;l<K;l++) { int a=P[l]; d[a]=1; pq.push({0, a}); } vector<bool>vis(N, false); while(!pq.empty()) { int a=pq.top().second, w=pq.top().first; pq.pop(); if(d[a]==0) { d[a]=1; continue; } if(vis[a]) continue; vis[a]=true; if(a==0) return w; for(auto u:adj[a]) { int to=u.first, s=u.second; if(vis[to]) continue; pq.push({w+s, to}); } } return -1; }

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

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:22:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   22 |   if(vis[a]) continue; vis[a]=true;
      |   ^~
crocodile.cpp:22:24: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   22 |   if(vis[a]) continue; vis[a]=true;
      |                        ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...