답안 #809044

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
809044 2023-08-05T14:42:34 Z TheSahib 악어의 지하 도시 (IOI11_crocodile) C++14
46 / 100
114 ms 262144 KB
#include "crocodile.h"
#include <bits/stdc++.h>

#define pii pair<int, int>
#define ll long long

using namespace std;

const int MAX = 3e5 + 5;

vector<pii> g[MAX];

int dp[MAX];
void dfs(int node, int p){
    vector<int> v;
    for(auto& e:g[node]){
        if(e.first == p) continue;
        dfs(e.first, node);
        v.push_back(dp[e.first] + e.second);
    }
    if(v.size() < 2) return;
    sort(v.begin(), v.end());
    dp[node] = v[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({R[i][1], L[i]});
        g[R[i][1]].push_back({R[i][0], L[i]});
    }
    dfs(0, 0);
    return dp[0];
}

# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Correct 4 ms 7380 KB Output is correct
3 Correct 5 ms 7380 KB Output is correct
4 Correct 4 ms 7436 KB Output is correct
5 Correct 4 ms 7372 KB Output is correct
6 Correct 4 ms 7380 KB Output is correct
7 Correct 5 ms 7380 KB Output is correct
8 Correct 4 ms 7380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Correct 4 ms 7380 KB Output is correct
3 Correct 5 ms 7380 KB Output is correct
4 Correct 4 ms 7436 KB Output is correct
5 Correct 4 ms 7372 KB Output is correct
6 Correct 4 ms 7380 KB Output is correct
7 Correct 5 ms 7380 KB Output is correct
8 Correct 4 ms 7380 KB Output is correct
9 Runtime error 114 ms 262144 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7380 KB Output is correct
2 Correct 4 ms 7380 KB Output is correct
3 Correct 5 ms 7380 KB Output is correct
4 Correct 4 ms 7436 KB Output is correct
5 Correct 4 ms 7372 KB Output is correct
6 Correct 4 ms 7380 KB Output is correct
7 Correct 5 ms 7380 KB Output is correct
8 Correct 4 ms 7380 KB Output is correct
9 Runtime error 114 ms 262144 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -