QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#54850#4197. Natural NavigationT3alaadl3k2olyehymn3kCompile Error//C++1.5kb2022-10-10 22:37:502022-10-10 22:37:53

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-10 22:37:53]
  • 评测
  • [2022-10-10 22:37:50]
  • 提交

answer

#include "bits/stdc++.h"

using namespace std;
#define int long long
int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<vector<pair<int, pair<int, int>>>> a(n + 1);//from dist color
    map<int, map<int, int>> colN;
    for (int i = 0; i < m; i++) {
        int u, v, w;
        cin >> u >> v >> w;
        int l;
        cin >> l;
        for (int j = 0; j < l; j++) {
            int clr;
            cin >> clr;
            a[v].push_back({u, {w, clr}});
            colN[u][clr]++;
        }
    }
    vector<int> dist(n + 33, -1);
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> pq;
    pq.push({0, n});
    dist[n] = 0;
    map<int, map<int, int>> colG;
    while (!pq.empty()) {
        auto X = pq.top();
        pq.pop();
        if (X.first != dist[X.second])continue;
        for (auto i: a[X.second]) {
            int dis = i.second.first + X.first;
            colG[i.first][i.second.second] = max(colG[i.first][i.second.second], dis);
            colN[i.first][i.second.second]--;
            if (colN[i.first][i.second.second] == 0) {
                int new_d = colG[i.first][i.second.second];
                if (colG[i.first][i.second.second] < dist[i.first] or dist[i.first] == -1) {
                    dist[i.first] = max(dist[i.first], colG[i.first][i.second.second]);
                    pq.push({new_d, i.first});
                }
            }
        }
    }
    if (~dist[1])
        cout << dist[1] << endl;
    else
        cout << "impossible" << endl;
}

Details

cc1plus: error: ‘::main’ must return ‘int’