제출 #972610

#제출 시각아이디문제언어결과실행 시간메모리
972610aykhn사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include "cyberland.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define OPT ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define pii pair<int,int> #define pll pair<ll,ll> #define pid pair<int,double> #define pld pair<ll,double> #define pdi pair<double,int> #define endl "\n" #define all(v) v.begin(), v.end() #define mpr make_pair #define pb push_back #define ts to_string #define fi first #define se second #define inf 0x3F3F3F3F #define bpc __builtin_popcount #define inf 0x3F3F3F3F #define infll 0x3F3F3F3F3F3F3F3FLL #define print(v) for(int i = 0; i < v.size(); i++) cout << v[i] << " "; cout<<endl; double solve(int n, int m, int K, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { K = min(K, 70); vector<vector<pld>> adj(n); for (ll i = 0; i < m; i++) { adj[x[i]].pb(mpr(y[i], c[i])); adj[y[i]].pb(mpr(x[i], c[i])); } vector<vector<double>> dist(n, vector<double> (K + 1, -1)); priority_queue< pair<double, pll>, vector< pair<double, pll> >, greater< pair<double, pll> > > pq; for (int i = 0; i < n; i++) { if (arr[i] == 0 || !i) { dist[i][0] = 0; pq.push(0, {0, i}); } } while (!pq.empty()) { double d = pq.top().fi; ll k = pq.top().se.fi; ll from = pq.top().se.se; pq.pop(); if (from == h) continue; if (d > dist[from][k]) continue; for (ll i = 0; i < adj[from].size(); i++) { ll to = adj[from][i].fi; double w = adj[from][i].se; if (arr[to] == 1 || arr[to] == 2) { if (dist[to][k] > d + w || dist[to][k] == -1) { dist[to][k] = d + w; pq.push(mpr(dist[to][k], mpr(k, to))); } } else if (arr[to] == 0) { if (dist[to][k] > 0 || dist[to][k] == -1) { dist[to][k] = 0; pq.push(mpr(dist[to][k], mpr(k, to))); } } if (k < K && arr[to] == 2) { if (dist[to][k + 1] > (d + w)/2 || dist[to][k + 1] == -1) { dist[to][k + 1] = (d + w)/2; pq.push(mpr(dist[to][k + 1], mpr(k + 1, to))); } } } } double res = -1; for (ll i = 0; i <= K; i++) { if (dist[h][i] == -1) continue; if (res == -1) res = dist[h][i]; else res = min(res, dist[h][i]); } 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:48:30: error: no matching function for call to 'std::priority_queue<std::pair<double, std::pair<long long int, long long int> >, std::vector<std::pair<double, std::pair<long long int, long long int> > >, std::greater<std::pair<double, std::pair<long long int, long long int> > > >::push(int, <brace-enclosed initializer list>)'
   48 |             pq.push(0, {0, i});
      |                              ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from cyberland.cpp:2:
/usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<double, std::pair<long long int, long long int> >; _Sequence = std::vector<std::pair<double, std::pair<long long int, long long int> > >; _Compare = std::greater<std::pair<double, std::pair<long long int, long long int> > >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<double, std::pair<long long int, long long int> >]'
  640 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:640:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/10/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<double, std::pair<long long int, long long int> >; _Sequence = std::vector<std::pair<double, std::pair<long long int, long long int> > >; _Compare = std::greater<std::pair<double, std::pair<long long int, long long int> > >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<double, std::pair<long long int, long long int> >]'
  648 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:648:7: note:   candidate expects 1 argument, 2 provided
cyberland.cpp:60:26: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<long long int, double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |         for (ll i = 0; i < adj[from].size(); i++)
      |                        ~~^~~~~~~~~~~~~~~~~~