답안 #385301

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
385301 2021-04-04T03:54:34 Z ngpin04 악어의 지하 도시 (IOI11_crocodile) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "crocodile.h"
//#include "crocodile.cpp"
#include "grader.cpp"
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int NN = 1e5 + 5;
const int oo = 1e9 + 1;

vector <pair <int, int>> adj[NN];

int dis[NN][3];
int n;

bool vis[NN];

int travel_plan(int n, int m, int r[][2], int l[], int k, int p[])
{
    for (int i = 0; i < m; i++) {
        int u = r[i][0];
        int v = r[i][1];
        int w = l[i];
        adj[u].push_back(mp(v, w));
        adj[v].push_back(mp(u, w));
    }
    for (int i = 0; i < n; i++)
    for (int j = 0; j < 3; j++)
        dis[i][j] = oo;

    priority_queue <pair <int, int>> heap;

    for (int i = 0; i < k; i++)
    for (int j = 0; j < 2; j++) {
        dis[p[i]][j] = 0;
        if (j == 1)
            heap.push(mp(0, p[i]));
    }
    while (heap.size()) {
        int u = heap.top().se;
        int cur = -heap.top().fi;
        heap.pop();
        if (vis[u] || dis[u][1] != cur)
            continue;
        vis[u] = true;
        for (pair <int, int> e : adj[u]) {
            int v = e.fi;
            int w = e.se;
            bool ok = false;
            dis[v][2] = cur + w;
            for (int i = 2; i >= 1; i--)
                if (dis[v][i] < dis[v][i - 1])
                    swap(dis[v][i], dis[v][i - 1]), ok = true;
            if (ok)
                heap.push(mp(-dis[v][1], v));
            //if (v == 0){
                //cerr << u << " " << v << " " << w << endl;
                //for (int i = 0; i < 3; i++)
                //    cerr << dis[0][i] << " ";
                //cerr << endl;
            //}
        }
    }
    return dis[0][1];
}

Compilation message

/tmp/cciKJTPK.o: In function `read_input()':
grader.cpp:(.text+0x0): multiple definition of `read_input()'
/tmp/ccoNfUKz.o:crocodile.cpp:(.text+0x40): first defined here
/tmp/cciKJTPK.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccoNfUKz.o:crocodile.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status