Submission #1273441

#TimeUsernameProblemLanguageResultExecution timeMemory
1273441zuz14Wall (IOI14_wall)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
    
vector<pair<int, long long>> g[100007];
long long times[100007];
bool if_exit[100007];

long long travel_plan(int n, int m, int r[][2], int l[], int k, int p[]){
    priority_queue<pair<long long, int>> q;
    long long dist;
    int v;

    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]});}
    for (int i=0; i<n; i++) times[i]=-1;

    q.push({0, 0});
    while (!q.empty()){
        dist=-q.top().F, v=q.top().S; q.pop();
        if (times[v]!=-1) continue;
        times[v]=dist;

        for (auto i:g[v]) if (times[i.F]==-1) q.push({-dist-i.S, i.F});
    }
    
    for (int i=0; i<k; i++) if_exit[p[i]]=1;

    int c;
    long long result=1e18, m1, m2;
    for (int i=0; i<n; i++){
        c=0;
        if (if_exit[i]) continue;
        for (auto j:g[i]) {
            if (if_exit[j.F]) {
                c++; //ha ha ha
                if (j.S<=m1) m2=m1, m1=j.S;
                else if (j.S<=m2) m2=j.S;
            }
        }
        if (c>=2) result=min(result, times[i]+m2);
    }

    return result;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cckyDHMw.o: in function `main':
grader.cpp:(.text.startup+0x123): undefined reference to `buildWall(int, int, int*, int*, int*, int*, int*)'
collect2: error: ld returned 1 exit status