Submission #384909

# Submission time Handle Problem Language Result Execution time Memory
384909 2021-04-02T15:55:49 Z izhang05 Crocodile's Underground City (IOI11_crocodile) C++17
Compilation error
0 ms 0 KB
#include "crocodile.h"
#include "crocodile_grader.cpp"

#include <bits/stdc++.h>

using namespace std;
//#define DEBUG
const int maxn = 1e3 + 5, inf = 1e9;
int sol[maxn];
bool ex[maxn];
vector<pair<int, int>> adj[maxn];

void dfs(int c, int p) {
    vector<int> pos;
    for (auto i : adj[c]) {
        if (i.first != p) {
            dfs(i.first, c);
            pos.push_back(sol[i.first] + i.second);
        }
    }
    sort(pos.begin(), pos.end());
    if (pos.size() <= 1) {
        sol[c] = -inf;
    } else {
        sol[c] = pos[1];
    }
    if (ex[c]) {
        sol[c] = 0;
    }
}

int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]) {
    for (int i = 0; i < m; ++i) {
        int a = r[i][0], b = r[i][1], cost = l[i];
        adj[a].emplace_back(b, cost);
        adj[b].emplace_back(a, cost);
    }
    for (int i = 0; i < k; ++i) {
        ex[p[i]] = true;
    }
    for (int i = 0; i < n; ++i) {
        sol[i] = -inf;
    }
    dfs(0, -1);
    return sol[0];
}

Compilation message

crocodile.cpp:2:10: fatal error: crocodile_grader.cpp: No such file or directory
    2 | #include "crocodile_grader.cpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.