Submission #17009

#TimeUsernameProblemLanguageResultExecution timeMemory
17009muratCrocodile's Underground City (IOI11_crocodile)C++98
100 / 100
696 ms199988 KiB
#include "crocodile.h" #include <bits/stdc++.h> using namespace std; #define dbgs(x) cerr << (#x) << " --> " << (x) << ' ' #define dbg(x) cerr << (#x) << " --> " << (x) << endl #define foreach(i,x) for(type(x)i=x.begin();i!=x.end();i++) #define FOR(ii,aa,bb) for(int ii=aa;ii<=bb;ii++) #define ROF(ii,aa,bb) for(int ii=aa;ii>=bb;ii--) #define type(x) __typeof(x.begin()) #define orta (bas + son >> 1) #define sag (k + k + 1) #define sol (k + k) #define pb push_back #define mp make_pair #define nd second #define st first #define endl '\n' typedef pair < int ,int > pii; typedef long long ll; const long long linf = 1e18+5; const int mod = (int) 1e9 + 7; const int logN = 17; const int inf = 1e9; const int N = 1e6 + 5; int h[N], n, m, x, y, z, ok[N]; vector< pii > v[N]; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { n = N; m = M; FOR(i, 0, m-1) { int x = ++R[i][0], y = ++R[i][1]; v[x].pb(mp(y, L[i])); v[y].pb(mp(x, L[i])); } priority_queue< pii , vector< pii >, greater< pii > > q; FOR(i, 0, K-1) { ok[P[i]+1] = 1; q.push(mp(0, ++P[i])); } while(!q.empty()) { int node = q.top().nd, cost = q.top().st; q.pop(); if(!ok[node]) { ok[node] = 1; continue; } else if(ok[node] > 1) continue; ok[node] = 2; if(node == 1) return cost; foreach(it, v[node]) q.push(mp(it->nd + cost, it->st)); } return -1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...