답안 #927252

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
927252 2024-02-14T14:08:21 Z hengliao 악어의 지하 도시 (IOI11_crocodile) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define F first
#define S second
#define pll pair<ll, ll>
#define vll vector<ll>
#define vllll vector<vector<ll, ll>>
#define debug(...) cout<<" [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "<<'\n';
typedef long long ll;

const int inf=1e9+5;

const int mxN=1e5+5;
vector<pair<int, int>> adj[mxN];
int dis[mxN];
bool done[mxN];

int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]){
    memset(done, 0, sizeof(done));
    priority_queue<pair<int, int>> pq;
    for(int i=0;i<n;i++){
        dis[i]=inf;
    }
    for(int i=0;i<m;i++){
        adj[r[i][0]].pb({r[i][1], l[i]});
        adj[r[i][1]].pb({r[i][0], l[i]});
    }
    for(int i=0;i<k;i++){
        dis[p[i]]=0;
        pq.push({0, p[i]});
    }
    while(!pq.empty()){
        pair<int, int> cur=pq.top(); pq.pop();
        if(dis[cur.S]<inf && cur.F!=0) continue;
        if(!done[cur.S] && cur.F!=0){
            done[cur.S]=1;
            continue;
        }
        dis[cur.S]=min(-cur.F, dis[cur.S]);
        for(auto it:adj[cur.S]){
            pq.push({-(-cur.F+it.S), it.F});
        }
    }

    return dis[0];
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int r[7][2]={{0, 2}, {0, 3}, {3, 2}, {2, 1}, {0, 1}, {0, 4}, {3, 4}};
    int l[7]={4, 3, 2, 10, 100, 7, 9};
    int p[2]={1, 3};
    cout<<travel_plan(5, 7, r, l, 2, p);
    return 0;
}

/*test case


*/



Compilation message

/usr/bin/ld: /tmp/ccfnGPcl.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccaSyOJk.o:crocodile.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status