# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136554 | 2019-07-25T13:48:24 Z | miguel | Crocodile's Underground City (IOI11_crocodile) | C++14 | 4 ms | 2680 KB |
#include<bits/stdc++.h> //#include<crocodile.h> using namespace std; #define pb push_back #define dbg(x) cout << #x << '=' << x << '\n'; #define ll long long #define x first #define y second #define pi pair <int, int> #define pii pair <int, pi> #define vi vector <int> const ll mod = 998244353; vector <pi> g[100001]; int t[100001], viz[100001]; priority_queue<pi, vector<pi>, greater<pi>> pq; int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]){ for(int i=0; i<n; i++) t[i]=1000000001; for(int i=0; i<k; i++) t[p[i]]=0; for(int i=0; i<m; i++){ g[r[i][0]].pb({r[i][1], l[i]}); g[r[i][1]].pb({r[i][0], l[i]}); } fill(viz, viz+n, 0); for(int i=0; i<k; i++) pq.push({0, -p[i]}), viz[i]=1; while(!pq.empty()){ int nod=pq.top().y, cost=pq.top().x; pq.pop(); if(viz[-nod]==0) viz[-nod]++; else if(viz[-nod]==1){ viz[-nod]++; if(nod==0) return cost; for(pi i: g[-nod]) pq.push({cost+i.y, -i.x}); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2680 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2680 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2680 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |