# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1080961 | DarkMatter | 철로 (IOI14_rail) | C++14 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "rail.h"
#include<bits/stdc++.h>
using namespace std;
void findLocation(int N, int first, int location[], int stype[])
{
location[0] = first, stype[0] = 1;
vector<vector<int>>dis(N, vector<int>(N));
for (int i = 0; i < N; i++)
for (int j = i + 1; j < N; j++)
dis[i][j] = dis[j][i] = getDistance(i, j);
priority_queue < pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>, greater<pair<int, int>>>pq;
vector<int>cost(N, 1e9 + 7);
vector<bool>vis(N, false);
cost[0] = 0, vis[0] = true;
for (int i = 1; i < N; i++)
cost[i] = dis[0][i], pq.push({ cost[i],{i,0} });
while (!pq.empty()) {
int curCost = pq.top().first, a = pq.top().second.first, b = pq.top().second.second;
pq.pop();
if (vis[a])
continue;
vis[a] = true;
if (stype[b] == 1)
location[a] = location[b] + dis[a][b], stype[a] = 2;
else
location[a] = location[b] - dis[a][b], stype[a] = 1;
for (int i = 0; i < N; i++)
if (!vis[i] && cost[i] > dis[a][i])
cost[i] = dis[a][i], pq.push({ cost[i],{i,a} });
}
}
컴파일 시 표준 에러 (stderr) 메시지
rail.cpp: In function 'void findLocation(int, int, int*, int*)': rail.cpp:18:7: warning: unused variable 'curCost' [-Wunused-variable] 18 | int curCost = pq.top().first, a = pq.top().second.first, b = pq.top().second.second; | ^~~~~~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:71, from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from rail.cpp:2: /usr/include/c++/10/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<int, std::pair<int, int> >*, std::vector<std::pair<int, std::pair<int, int> > > >; _Value = std::pair<int, std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >]': /usr/include/c++/10/bits/stl_heap.h:139:48: required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<std::pair<int, std::pair<int, int> >*, std::vector<std::pair<int, std::pair<int, int> > > >; _Distance = long int; _Tp = std::pair<int, std::pair<int, int> >; _Compare = __gnu_cxx::__ops::_Iter_comp_val<std::greater<std::pair<int, int> > >]' /usr/include/c++/10/bits/stl_heap.h:215:23: required from 'void std::push_heap(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<std::pair<int, std::pair<int, int> >*, std::vector<std::pair<int, std::pair<int, int> > > >; _Compare = std::greater<std::pair<int, int> >]' /usr/include/c++/10/bits/stl_queue.h:651:16: required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<int, std::pair<int, int> >; _Sequence = std::vector<std::pair<int, std::pair<int, int> > >; _Compare = std::greater<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, std::pair<int, int> >]' rail.cpp:16:49: required from here /usr/include/c++/10/bits/predefined_ops.h:194:23: error: no match for call to '(std::greater<std::pair<int, int> >) (std::pair<int, std::pair<int, int> >&, std::pair<int, std::pair<int, int> >&)' 194 | { return bool(_M_comp(*__it, __val)); } | ~~~~~~~^~~~~~~~~~~~~~ In file included from /usr/include/c++/10/string:48, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from rail.cpp:2: /usr/include/c++/10/bits/stl_function.h:375:7: note: candidate: 'constexpr bool std::greater<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = std::pair<int, int>]' 375 | operator()(const _Tp& __x, const _Tp& __y) const | ^~~~~~~~ /usr/include/c++/10/bits/stl_function.h:375:29: note: no known conversion for argument 1 from 'std::pair<int, std::pair<int, int> >' to 'const std::pair<int, int>&' 375 | operator()(const _Tp& __x, const _Tp& __y) const | ~~~~~~~~~~~^~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:71, from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from rail.cpp:2: /usr/include/c++/10/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = __gnu_cxx::__normal_iterator<std::pair<int, std::pair<int, int> >*, std::vector<std::pair<int, std::pair<int, int> > > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::pair<int, std::pair<int, int> >*, std::vector<std::pair<int, std::pair<int, int> > > >; _Compare = std::greater<std::pair<int, int> >]': /usr/include/c++/10/bits/stl_heap.h:231:14: required from 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<std::pair<int, std::pair<int, int> >*, std::vector<std::pair<int, std::pair<int, int> > > >; _Distance = long int; _Tp = std::pair<int, std::pair<int, int> >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<std::pair<int, int> > >]' /usr/include/c++/10/bits/stl_heap.h:263:25: required from 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<std::pair<int, std::pair<int, int> >*, std::vector<std::pair<int, std::pair<int, int> > > >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<std::greater<std::pair<int, int> > >]' /usr/include/c++/10/bits/stl_heap.h:332:19: required from 'void std::pop_heap(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<std::pair<int, std::pair<int, int> >*, std::vector<std::pair<int, std::pair<int, int> > > >; _Compare = std::greater<std::pair<int, int> >]' /usr/include/c++/10/bits/stl_queue.h:678:15: required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::pop() [with _Tp = std::pair<int, std::pair<int, int> >; _Sequence = std::vector<std::pair<int, std::pair<int, int> > >; _Compare = std::greater<std::pair<int, int> >]' rail.cpp:19:10: required from here /usr/include/c++/10/bits/predefined_ops.h:156:30: error: no match for call to '(std::greater<std::pair<int, int> >) (std::pair<int, std::pair<int, int> >&, std::pair<int, std::pair<int, int> >&)' 156 | { return bool(_M_comp(*__it1, *__it2)); } | ~~~~~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/10/string:48, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from rail.cpp:2: /usr/include/c++/10/bits/stl_function.h:375:7: note: candidate: 'constexpr bool std::greater<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = std::pair<int, int>]' 375 | operator()(const _Tp& __x, const _Tp& __y) const | ^~~~~~~~ /usr/include/c++/10/bits/stl_function.h:375:29: note: no known conversion for argument 1 from 'std::pair<int, std::pair<int, int> >' to 'const std::pair<int, int>&' 375 | operator()(const _Tp& __x, const _Tp& __y) const | ~~~~~~~~~~~^~~