답안 #997935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
997935 2024-06-13T06:56:35 Z overwatch9 악어의 지하 도시 (IOI11_crocodile) C++17
46 / 100
2 ms 4700 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector <vector <pair <int, int>>> adj;
vector <bool> is_exit;
ll dfs(int s, int p) {
    if (adj[s].size() == 1 && s != p)
        return 0;
    vector <ll> x;
    for (auto i : adj[s]) {
        if (i.first == p)
            continue;
        x.push_back(dfs(i.first, s) + i.second);
    }
    sort(x.begin(), x.end());
    return x[1];
}
int travel_plan(int N, int M, int R[][2], int W[], int K, int P[]) {
    adj.resize(N+1);
    is_exit = vector <bool> (N+1);
    for (int i = 0; i < M; i++) {
        int a = R[i][0], b = R[i][1];
        int w = W[i];
        adj[a].push_back({b, w});
        adj[b].push_back({a, w});
    }
    for (int i = 0; i < K; i++)
        is_exit[P[i]] = true;
    if (M > N-1)
        return 0;
    return dfs(0, 0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Incorrect 2 ms 4700 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Incorrect 2 ms 4700 KB Output isn't correct
10 Halted 0 ms 0 KB -