Submission #990986

# Submission time Handle Problem Language Result Execution time Memory
990986 2024-06-01T03:18:23 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 ALL(a) a.begin(), a.end()
using pii = pair<int, int>;
const int N = 1e3 + 5;

vector<pii> adj[N];
int cnt[N];

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

int 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();
    priority_queue<pii, vector<pii>, greater<pii>> Q;

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

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

    for(int i = 0; i < n; i++)
        sort(ALL(adj[i]), [&](pii a, pii b) {
        return a.second < b.second;
    });

    int ans = -1;

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

        if(cnt[u] == 2) {
            for(auto [v, w] : adj[u]) {
                if(v == 0) {
                    ans = weight + w;
                    break;
                }

                Q.emplace(weight + w, v);
            }
        }
    }

    return ans;
}

Compilation message

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