이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std ;
const int N = 1010 ;
#define ff first
#define ss second
#define pb push_back
int dp[N];
vector <pair<int,int>> G[N] ;
int go ( int u, int p ) {
int frMn = INT_MAX, scMn = (G[u].size()!=1)*INT_MAX;
for ( auto v:G[u] ) {
if ( p == v.ff ) continue ;
go ( v.ff, u ) ;
if ( dp[v.ff] + v.ss <= frMn ) scMn = frMn,frMn = dp[v.ff] + v.ss ;
else if ( dp[v.ff] + v.ss < scMn ) scMn = dp[v.ff] + v.ss ;
}
dp[u] = scMn ;
}
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
for ( int i = 0 ; i < M; ++i ) G[R[i][0]].pb ( { R[i][1], L[i] } ), G[R[i][1]].pb({R[i][0],L[i]}) ;
return go(0,-1);
}
컴파일 시 표준 에러 (stderr) 메시지
crocodile.cpp: In function 'int go(int, int)':
crocodile.cpp:22:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |