Submission #137016

#TimeUsernameProblemLanguageResultExecution timeMemory
137016MladenPCrocodile's Underground City (IOI11_crocodile)C++17
100 / 100
904 ms67364 KiB
#include "crocodile.h" #include <bits/stdc++.h> #define MAXN 100010 #define STIZE(x) fprintf(stderr, "STIZE%d\n", x); #define PRINT(x) fprintf(stderr, "%s = %d\n", #x, x); #define NL(x) printf("%c", " \n"[(x)]); #define lld long long #define pii pair<int,int> #define pb push_back #define fi first #define se second #define mid (l+r)/2 #define endl '\n' #define all(a) begin(a),end(a) #define sz(a) int((a).size()) #define LINF 1000000000000000LL #define INF 1000000000 #define EPS 1e-9 using namespace std; priority_queue<pii, vector<pii>, greater<pii> > pq; int dist[MAXN], pos[MAXN]; vector<pii> adj[MAXN]; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for(int i = 0; i < N; i++) dist[i] = pos[i] = -1; for(int i = 0; i < K; i++) { pq.push({0, P[i]}); pq.push({0, P[i]}); } for(int i = 0; i < M; i++) { adj[R[i][0]].pb({R[i][1], L[i]}); adj[R[i][1]].pb({R[i][0], L[i]}); } while(!pq.empty()) { pii vrh = pq.top(); pq.pop(); if(dist[vrh.se] != -1 && pos[vrh.se] != -1) continue; else if(pos[vrh.se] == -1) { pos[vrh.se] = vrh.fi; } else { dist[vrh.se] = vrh.fi; for(auto x : adj[vrh.se]) { if(dist[x.fi] == -1) { pq.push({vrh.fi+x.se, x.fi}); } } } } return dist[0]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...