답안 #240222

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
240222 2020-06-18T21:59:36 Z oscarsierra12 악어의 지하 도시 (IOI11_crocodile) C++14
0 / 100
5 ms 384 KB
#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] ;
const int oo = 1e9+2 ;
int go ( int u, int p ) {
    int frMn = oo, scMn = (G[u].size()!=1)*oo;
    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);
}


Compilation message

crocodile.cpp: In function 'int go(int, int)':
crocodile.cpp:22:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -