This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// IOI 2011 crocodile
#include <bits/stdc++.h>
#define MX 100000
using namespace std;
int N, M, K;
vector<pair<int, int> > edges[MX + 1];
int dist1[MX + 1], dist2[MX + 1];
bool visited[MX + 1];
priority_queue<pair<int, int> > q;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
	for (int i = 0; i < M; i++) {
        int a = R[i][0], b = R[i][1], c = L[i];
        edges[a].push_back({b, c});
        edges[b].push_back({a, c});
    }
	memset(dist1, 0x3f, sizeof(dist1));
    memset(dist2, 0x3f, sizeof(dist2));
    for (int i = 0; i < K; i++) {
        int x = P[i];
        dist1[x] = dist2[x] = 0;
        q.push({0, x});
    }
    while (q.size()) {
        int node = q.top().second;
        q.pop();
        if (visited[node]) continue;
        visited[node] = true;
        for (auto& edge : edges[node]) {
            if (dist2[node] + edge.second < dist1[edge.first]) {
                dist2[edge.first] = dist1[edge.first];
                dist1[edge.first] = dist2[node] + edge.second;
                q.push({-dist2[edge.first], edge.first});
            }
            else if (dist2[node] + edge.second < dist2[edge.first]) {
                dist2[edge.first] = dist2[node] + edge.second;
                q.push({-dist2[edge.first], edge.first});
            }
        }
    }
  	return dist2[0];
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |