제출 #965667

#제출 시각아이디문제언어결과실행 시간메모리
965667aykhn사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include "cyberland.h" #include "bits/stdc++.h" using namespace std; #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define pdi pair<double, int> #define vi vector<int> #define vl vector<ll> #define vii vector<pii> #define vll vector<pll> #define all(x) x.begin(), x.end() #define endl '\n' #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); const int sz = 1e5 + 5; ll type[sz], n, m, k, h; long double d[sz][31]; vii g[sz]; 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) { n = N, m = M, k = K, h = H; for(int i = 0; i < M; i++){ g[x[i] + 1].push_back({y[i] + 1, c[i]}); g[y[i] + 1].push_back({x[i] + 1, c[i]}); } for(int i = 1; i <= n; i++){ for(int j = 0; j <= k; j++){ d[i][j] = 1e18; } } priority_queue<pair<pdi, int>, vector<pair<pdi, int>>, greater<pair<pdi, int>>> pq; pq.push({{0.0, 0}, 1}); d[1][0] = 0; for(int i = 1; i < n; i++){ if(arr[i] == 0) pq.push({{0.0, 0}, i + 1}), d[i + 1][0] = 0; } while(!pq.empty()){ int cur = pq.top().second, j = pq.top().first.second; if(d[cur][j] < pq.top().first.first){ pq.pop(); continue; } pq.pop(); for(pii i : g[cur]){ if(d[i.first][j] > d[cur][j] + i.second){ d[i.first][j] = d[cur][j] + i.second; pq.push({{d[i.first][j], j}, i.first}); } if(arr[cur] == 2 and j + 1 <= k and d[i.first][j + 1] > d[cur][j] / 2 + i.second){ d[i.first][j + 1] = d[cur][j] / 2 + i.second; pq.push({{d[i.first][j + 1], j + 1}, i.first}); } } } double res = 1e18; for(int i = 0; i <= k; i++){ res = min(res, d[H + 1][i]); } if(res == 1e18) return -1; return res; }

컴파일 시 표준 에러 (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:59:35: error: no matching function for call to 'min(double&, long double&)'
   59 |         res = min(res, d[H + 1][i]);
      |                                   ^
In file included from /usr/include/c++/10/vector:60,
                 from cyberland.h:1,
                 from cyberland.cpp:1:
/usr/include/c++/10/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++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
cyberland.cpp:59:35: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'long double')
   59 |         res = min(res, d[H + 1][i]);
      |                                   ^
In file included from /usr/include/c++/10/vector:60,
                 from cyberland.h:1,
                 from cyberland.cpp:1:
/usr/include/c++/10/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++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
cyberland.cpp:59:35: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'long double')
   59 |         res = min(res, d[H + 1][i]);
      |                                   ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from cyberland.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
cyberland.cpp:59:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   59 |         res = min(res, d[H + 1][i]);
      |                                   ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from cyberland.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
cyberland.cpp:59:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   59 |         res = min(res, d[H + 1][i]);
      |                                   ^