이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "crocodile.h"
#include<bits/stdc++.h>
#define F first
#define S second
#define ll long long
using namespace std;
const ll INF=1e18, N=100005;
pair<ll, ll> D[N];
vector<pair<int, ll> > v[N];
priority_queue <pair<ll, int>, vector<pair<ll, int> >, greater<pair<ll, int> > > q;
int travel_plan(int n, int m, int R[][2], int L[], int k, int p[]){
for (int i=0; i<m; i++)
v[R[i][0]].push_back({R[i][1], L[i]}),
v[R[i][1]].push_back({R[i][0], L[i]});
for (int i=0; i<n; i++)D[i]={INF, INF};
for (int i=0; i<k; i++)D[p[i]]={0, 0},q.push({0, p[i]});
while(!q.empty()){
long long d=q.top().F;
int x=q.top().S;
q.pop();
if(d>D[x].F)continue;
for (auto [y, l] : v[x]){
ll o=D[y].F;
if(D[y].F>d+l){
D[y].F=d+l;
if(D[y].F<D[y].S)swap(D[y].F, D[y].S);
if(D[y].F!=o)q.push({D[y].F, y});
}
}
}
return D[0].F;
}
컴파일 시 표준 에러 (stderr) 메시지
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:28:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
28 | for (auto [y, l] : v[x]){
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |