제출 #1179785

#제출 시각아이디문제언어결과실행 시간메모리
1179785Dedibeat사이버랜드 (APIO23_cyberland)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; using node = pair<double, int>; vector<vector<node>> adj; vector<int> reach; int dest; void dfs(int v) { reach[v] = 1; for(auto [u, w] : adj[v]) { if(!reach[u] && u != dest) dfs(u); } } double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> a) { K = min(K, 90); adj.assign(N, {}); reach.assign(N, 0); 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]); } dest = H; dfs(0); priority_queue<node, vector<node>, greater<>> q; vector<double> dist(N, 1e18); for(int i = 0; i < N; i++) { if(a[i] == 0 && reach[i]) dist[i] = 0, q.emplace(0, i); } ll ans = 1e18; q.emplace(0, 0); while(K--) { priority_queue<node, vector<node>, greater<>> next_q; vector<double> next_dist(N, 1e18); while(q.empty()) { auto [c, v] = q.top(); q.pop(); if(abs(c - dist[v]) > 1e-9) continue; if(v == H) ans = min(ans, c); for(auto [u, w] : adj[v]) { if(c + w < dist[u]) { dist[u] = c + w; q.emplace(c + w, u); } } if(a[v] == 2 && c < 2 * next_dist[v]) { next_dist[v] = c / 2; next_q.emplace(c / 2, v); } dist = next_dist; q = next_q; } } if(reach[H]) return ans; else return -1; }

컴파일 시 표준 에러 (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:49:45: error: no matching function for call to 'min(ll&, std::tuple_element<0, std::pair<double, int> >::type&)'
   49 |                         if(v == H) ans = min(ans, c);
      |                                          ~~~^~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from cyberland.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
cyberland.cpp:49:45: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'std::tuple_element<0, std::pair<double, int> >::type' {aka 'double'})
   49 |                         if(v == H) ans = min(ans, c);
      |                                          ~~~^~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from cyberland.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
cyberland.cpp:49:45: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'std::tuple_element<0, std::pair<double, int> >::type' {aka 'double'})
   49 |                         if(v == H) ans = min(ans, c);
      |                                          ~~~^~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from cyberland.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3449:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3449 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3449:5: note:   template argument deduction/substitution failed:
cyberland.cpp:49:45: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   49 |                         if(v == H) ans = min(ans, c);
      |                                          ~~~^~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from cyberland.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3455:5: note:   template argument deduction/substitution failed:
cyberland.cpp:49:45: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   49 |                         if(v == H) ans = min(ans, c);
      |                                          ~~~^~~~~~~~