Submission #957674

#TimeUsernameProblemLanguageResultExecution timeMemory
957674ALTAKEXECyberland (APIO23_cyberland)C++17
8 / 100
26 ms7388 KiB
#include <bits/stdc++.h> #define ll long long #define f first #define s second using namespace std; struct T { 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<T>> 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 t = q.top().second, dist = q.top().f; q.pop(); if (ans[t] < dist) continue; for (auto [v, w] : v[t]) { if (ans[t] + w < ans[v]) { ans[v] = ans[t] + 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:24:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<T> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |   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...