Submission #957672

#TimeUsernameProblemLanguageResultExecution timeMemory
957672ALTAKEXECyberland (APIO23_cyberland)C++17
8 / 100
25 ms7384 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; struct node { ll b, w; }; double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr) { vector<vector<node>> v(N); for (int i = 0; i < M; i++) { v[x[i]].push_back({y[i], c[i]}); v[y[i]].push_back({x[i], c[i]}); } vector<ll> ans(N, LLONG_MAX); int st = 0; priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<>> Q; ans[st] = 0; Q.push({0, st}); for (int i = 0; i < v.size(); i++) { if (i == st) continue; if (arr[i] == 0) { ans[i] = 0; Q.push({0, st}); } } while (!Q.empty()) { ll node = Q.top().second, dist = Q.top().first; Q.pop(); if (ans[node] < dist) continue; for (auto [v, w] : v[node]) { if (ans[node] + w < ans[v]) { ans[v] = ans[node] + w; Q.push({ans[v], v}); } } } return ans[H]; }

Compilation message (stderr)

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:22:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<node> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   for (int i = 0; i < v.size(); i++)
      |                   ~~^~~~~~~~~~
#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...