Submission #1153169

#TimeUsernameProblemLanguageResultExecution timeMemory
1153169burgerguyCyberland (APIO23_cyberland)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; 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<pair<ll,ll>>> adj(N); for (int i = 0; i < M; i++) { adj[x[i]].emplace_back(y[i], c[i]); adj[y[i]].emplace_back(x[i], c[i]); } priority_queue<pair<ll,ll>, vector<pair<double,ll>>, greater<>> pq; pq.emplace(0, 0); vector<bool> vis(N); vector<double> dist(N, INT_MAX); dist[0] = 0; while(!pq.empty()) { ll curCountry = pq.top().second; double curScore = pq.top().first; pq.pop(); if(vis[curCountry]) continue; vis[curCountry] = true; if(curCountry == H) continue; for(pair<ll,ll> u : adj[curCountry]) { ll newScore = curScore + u.second; if(newScore < dist[u.first]) { dist[u.first] = newScore; pq.emplace(newScore, u.first); } } } double ans = 0; if(!vis[H]) ans = -1; else ans = dist[H]; return ans; }

Compilation message (stderr)

In file included from /usr/include/c++/11/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:86,
                 from cyberland.cpp:1:
/usr/include/c++/11/bits/stl_queue.h: In instantiation of 'class std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<double, long long int> >, std::greater<void> >':
cyberland.cpp:13:69:   required from here
/usr/include/c++/11/bits/stl_queue.h:480:67: error: static assertion failed: value_type must be the same as the underlying container
  480 |       static_assert(is_same<_Tp, typename _Sequence::value_type>::value,
      |                                                                   ^~~~~
/usr/include/c++/11/bits/stl_queue.h:480:67: note: 'std::integral_constant<bool, false>::value' evaluates to false