답안 #568193

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
568193 2022-05-24T21:04:03 Z n0sk1ll 악어의 지하 도시 (IOI11_crocodile) C++17
46 / 100
146 ms 262144 KB
#include "crocodile.h"

#include <bits/stdc++.h>

#define xx first
#define yy second

using namespace std;
long long int typedef li;

vector<vector<pair<int,int>>> g(100003);
li dp[100003];

void dfs(int p, int q)
{
    if (g[p].size()==1) return;

    vector<li> vals;
    for (auto it : g[p]) if (it.yy!=q)
    {
        dfs(it.yy,p);
        vals.push_back(dp[it.yy]+it.xx);
    }

    sort(vals.begin(),vals.end());
    dp[p]=vals[1];
}

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]].push_back({L[i],R[i][1]});
        g[R[i][1]].push_back({L[i],R[i][0]});
    }

    dfs(0,-1);
    return dp[0];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2680 KB Output is correct
7 Correct 2 ms 2772 KB Output is correct
8 Correct 2 ms 2772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2680 KB Output is correct
7 Correct 2 ms 2772 KB Output is correct
8 Correct 2 ms 2772 KB Output is correct
9 Runtime error 146 ms 262144 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2680 KB Output is correct
7 Correct 2 ms 2772 KB Output is correct
8 Correct 2 ms 2772 KB Output is correct
9 Runtime error 146 ms 262144 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -