답안 #232194

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
232194 2020-05-16T10:54:52 Z semiauto 악어의 지하 도시 (IOI11_crocodile) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
vector <pair<int,int> > v[1000000];
priority_queue <pair<int,int> > q;
pair <int,int> ans[1000000];
int main() {
    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 0; i < n; i++) {
        ans[i] = {1000000000, 1000000000};
    }
    for (int i = 0; i < m; i++) {
        int a, b, c;
        scanf("%d %d %d", &a, &b, &c);
        v[a].push_back({b, c});
        v[b].push_back({a, c});
    }
    for (int i = 0; i < k; i++) {
        int a;
        cin >> a;
        q.push({0, a});
        ans[a] = {0,0};
    }
    while (q.size()) {
        int p = q.top().second;
        int pp = q.top().first;
        q.pop();
        if (ans[p].second + pp != 0)
            continue;
        for (int i = 0; i < v[p].size(); i++) {
            int a = v[p][i].first;
            int b = v[p][i].second;
            if (ans[a].second <= ans[p].second + b)
                continue;
            if (ans[a].first <= ans[p].second + b) {
                ans[a].second = ans[p].second + b;
            } else {
                ans[a].second = ans[a].first;
                ans[a].first = ans[p].second + b;
            }
            q.push({-ans[a].second, a});
        }
    }
    cout << ans[0].second << endl;
}

Compilation message

crocodile.cpp: In function 'int main()':
crocodile.cpp:30:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < v[p].size(); i++) {
                         ~~^~~~~~~~~~~~~
crocodile.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d", &a, &b, &c);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/tmp/cc4PAOMd.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cciwrSHM.o:crocodile.cpp:(.text.startup+0x0): first defined here
/tmp/cc4PAOMd.o: In function `main':
grader.cpp:(.text.startup+0x2d): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status