답안 #59935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
59935 2018-07-23T10:46:27 Z theknife2001 악어의 지하 도시 (IOI11_crocodile) C++17
46 / 100
1038 ms 263168 KB
#include <bits/stdc++.h>
#include "crocodile.h"
#define ii pair < int , int >
#define fi first
#define se second


using namespace std;
vector < ii > vec[1005];
long long dp[1005];


void dfs(int u , int p)
{
    long long mn1,mn2;
    mn1=mn2=1e9+7;
    int v,c;
    for(auto x:vec[u])
    {
        v=x.fi;
        c=x.se;
        if(v==p)
            continue ;
        dfs(v,u);
        if(mn2>dp[v]+c)
            mn2=dp[v]+c;
        if(mn1>mn2)
            swap(mn1,mn2);
    }
    dp[u]=mn2;
    if(vec[u].size()==1)
        dp[u]=0;
}

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
    for(int i=0;i<M;i++)
    {
        vec[R[i][1]].push_back({R[i][0],L[i]});
        vec[R[i][0]].push_back({R[i][1],L[i]});
    }
    dfs(0,0);
    return dp[0];
}


# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 4 ms 492 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 4 ms 608 KB Output is correct
5 Correct 4 ms 700 KB Output is correct
6 Correct 3 ms 700 KB Output is correct
7 Correct 2 ms 800 KB Output is correct
8 Correct 4 ms 832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 4 ms 492 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 4 ms 608 KB Output is correct
5 Correct 4 ms 700 KB Output is correct
6 Correct 3 ms 700 KB Output is correct
7 Correct 2 ms 800 KB Output is correct
8 Correct 4 ms 832 KB Output is correct
9 Runtime error 1038 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 4 ms 492 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 4 ms 608 KB Output is correct
5 Correct 4 ms 700 KB Output is correct
6 Correct 3 ms 700 KB Output is correct
7 Correct 2 ms 800 KB Output is correct
8 Correct 4 ms 832 KB Output is correct
9 Runtime error 1038 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Halted 0 ms 0 KB -