제출 #750474

#제출 시각아이디문제언어결과실행 시간메모리
750474Gurban사이버랜드 (APIO23_cyberland)C++17
8 / 100
39 ms7608 KiB
#include "cyberland.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const ll inf = 1e16; const int maxn=1e5+5; // const double eps = 0.00000001; int D[maxn]; vector<pair<int,ll>>E[maxn]; double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { for(int i = 0;i < N;i++) E[i].clear(); for(int i = 0;i < M;i++){ E[x[i]].push_back({y[i],c[i]}); E[y[i]].push_back({x[i],c[i]}); } ll ans = inf; priority_queue<pair<ll,int>>q; vector<ll>dis(N,inf); vector<bool>vis(N,0); dis[H] = 0; q.push({0,H}); while(!q.empty()){ int x = q.top().second; q.pop(); if(vis[x]) continue; vis[x] = 1; for(auto i : E[x]){ if(dis[i.first] > dis[x] + i.second){ dis[i.first] = dis[x] + i.second; q.push({-dis[i.first],i.first}); } } } ans = dis[0]; for(int i = 0;i < N;i++) if(arr[i] == 0) ans = min(ans,dis[i]); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...