Submission #488219

#TimeUsernameProblemLanguageResultExecution timeMemory
488219levsog2004Evacuation plan (IZhO18_plan)C++14
0 / 100
3752 ms524292 KiB
#include <iostream> #include <iomanip> #include <fstream> #include <algorithm> #include <cstring> #include <string> #include <vector> #include <queue> #include <deque> #include <stack> #include <cmath> #include <list> #include <set> #include <map> using namespace std; typedef int ll; #define all(x) x.begin(),x.end() #define al(a,n) (a,a+n) #define se second #define fr first #define m_p make_pair const ll N = 100005; const ll mod = 1000 * 1000 * 1000 + 7; const ll inf = 1000000009; ll n, m, k, z, t, x, y, ans, pat, a[N],c[N],dist[N]; vector<pair<ll, ll>> g[N]; pair<ll, ll> p; int main() { cin >> n >> m; for (int i = 0; i < m; ++i) { cin >> x >> y >> z; g[x].push_back({ y,z }); g[y].push_back({ x,z }); } cin >> k; priority_queue<pair<ll, ll>> q; for (int i = 0; i <= n; ++i) dist[i] = inf; for (int i = 0; i < k; ++i) { cin >> a[i]; q.push({ 0,a[i] }); dist[a[i]] = 0; c[a[i]] = 1; } while (q.size() > 0) { p = q.top(); q.pop(); x = p.first*-1; y = p.second; for (int i = 0; i < g[y].size(); ++i) { if (dist[g[y][i].first] > x + g[y][i].second) { q.push({-1*(x+g[y][i].second),g[y][i].first}); } } } cin >> ans; for (int i = 0; i < ans; ++i) { cin >> x >> y; cout << min(dist[x], dist[y]) << endl; } return 0; }

Compilation message (stderr)

plan.cpp: In function 'int main()':
plan.cpp:55:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |   for (int i = 0; i < g[y].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...