Submission #1061428

#TimeUsernameProblemLanguageResultExecution timeMemory
1061428GangstaCyberland (APIO23_cyberland)C++17
0 / 100
381 ms16732 KiB
#include "bits/stdc++.h" #define ll long long int #define pb push_back #define pii pair<int,int> #define ff first #define ss second #define sz size() const int N = 2e5 + 1; using namespace std; vector <long double> dis(N,1e15); priority_queue <pair<long double, int>> pq; vector <pii> v[N]; void dij(vector<int>arr){ pq.push({0,0}); dis[0] = 0; while(!pq.empty()){ int a = pq.top().ss; pq.pop(); for(auto i: v[a]){ if(arr[i.ff] == 0 and dis[a] < dis[i.ff]){ dis[i.ff] = dis[a]; pq.push({-dis[i.ff],i.ff}); } else if(arr[i.ff] == 1 and dis[a] + i.ss < dis[i.ff]){ dis[i.ff] = dis[a] + i.ss; pq.push({-dis[i.ff],i.ff}); } else if(arr[i.ff] == 2 and dis[a] + (long double)(i.ss/2) < dis[i.ff]){ dis[i.ff] = (long double)(i.ss/2); pq.push({-dis[i.ff],i.ff}); } } } } 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 = 1; i <= m; i++){ v[x[i]].pb({y[i],c[i]}); v[y[i]].pb({x[i],c[i]}); } dij(arr); return dis[h]; } // int main(){ // ios::sync_with_stdio(false); cin.tie(nullptr); // }
#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...