Submission #990978

# Submission time Handle Problem Language Result Execution time Memory
990978 2024-06-01T02:42:24 Z vjudge1 Crocodile's Underground City (IOI11_crocodile) C++17
Compilation error
0 ms 0 KB
#include "crocodilelib.h"
#include<bits/stdc++.h>
using namespace std;
#define prev _____prev
#define ALL(a) a.begin(), a.end()
using i64 = long long;
using pii = pair<int, int>;
using pli = pair<i64, int>;
const int N = 1e3 + 5;

vector<pii> adj[N];
int prev[N];
i64 dist[N];
pli best[N][2];
i64 ans = 0;

void connect(int u, int v, int w) {
    adj[u].emplace_back(v, w);
    adj[v].emplace_back(u, w);
}

void DFS(int u, int p) {

    for(auto [v, w] : adj[u]) {
        if(v == p)
            continue;

        if(v != best[u][1].second)
            continue;

        ans += w;
        DFS(v, u);
    }
}

i64 solve(int n, const vector<int> &u, const vector<int> &v, const vector<int> &l, const vector<int> &a) {
    int nEdges = u.size();
    int nExits = a.size();
    memset(dist, 0x3f, sizeof dist);
    memset(best, 0x3f, sizeof best);

    for(int i = 0; i < nEdges; i++)
        connect(u[i], v[i], l[i]);

    priority_queue<pli, vector<pli>, greater<pli>> Q;

    for(int i = 0; i < nExits; i++) {
        dist[a[i]] = 0;
        Q.emplace(dist[a[i]], a[i]);
    }

    while(!Q.empty()) {
        auto [weight, u] = Q.top();
        Q.pop();

        if(dist[u] != weight)
            continue;

        for(auto [v, w] : adj[u]) {
            if(dist[v] > dist[u] + w) {
                dist[v] = dist[u] + w;
                Q.emplace(dist[v], v);
            }

            vector<pli> b;

            for(int i = 0; i < 2; i++)
                b.emplace_back(best[v][i]);

            b.emplace_back(dist[u] + w, u);
            sort(ALL(b));

            for(int i = 0; i < 2; i++)
                best[v][i] = b[i];
        }
    }

    DFS(0, 0);
    return ans;
}

Compilation message

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