# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
218023 | Andrei_Cotor | 경주 (Race) (IOI11_race) | C++11 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<race.h>
#include<vector>
#include<set>
using namespace std;
int nrPaths;
set<pair<long long,int> > S[200005];
vector<pair<int,int> > A[200005];
int HPath[200005],Lev[200005];
long long Dist[200005];
int dfs(int nod, int p, int L)
{
int rez=1000000000;
for(auto other:A[nod])
{
if(other.first==p)
continue;
Dist[other.first]=Dist[nod]+other.second;
Lev[other.first]=Lev[nod]+1;
rez=min(rez,dfs(other.first,nod,L));
if(S[HPath[other.first]].size()>S[HPath[nod]].size())
HPath[nod]=HPath[other.first];
}
if(HPath[nod]==0)
HPath[nod]=++nrPaths;
int path=HPath[nod];
for(auto other:A[nod])
{
if(other.first==p || path==HPath[other.first])
continue;
for(auto el:S[HPath[other.first]])
{
int dist=L-(el.first-Dist[nod])+Dist[nod];
if(dist>Dist[nod])
{
set<pair<int,int> >::iterator it=S[path].lower_bound({dist,0});
if(it!=S[path].end() && (*it).first==dist)
rez=min(rez,(*it).second+el.second-2*Lev[nod]);
}
set<pair<int,int> >::iterator it=S[path].lower_bound({el.first,0});
if(it!=S[path].end() && (*it).first==el.first)
{
if(el.second<(*it).second)
{
S[path].erase(it);
S[path].insert(el);
}
}
else
S[path].insert(el);
}
}
S[path].insert({Dist[nod],Lev[nod]});
set<pair<int,int> >::iterator it=S[path].lower_bound({Dist[nod]+L,0});
if(it!=S[path].end() && (*it).first==Dist[nod]+L)
rez=min(rez,(*it).second-Lev[nod]);
return rez;
}
int best_path(int n, int k, int E[][2], int L[])
{
for(int i=0; i<=n-2; i++)
{
A[E[i][0]].push_back({E[i][1],L[i]});
A[E[i][1]].push_back({E[i][0],L[i]});
}
int rez=dfs(0,-1,k);
if(rez==1000000000)
rez=-1;
return rez;
}
컴파일 시 표준 에러 (stderr) 메시지
race.cpp: In function 'int dfs(int, int, int)': race.cpp:43:69: error: conversion from 'std::set<std::pair<long long int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<long long int, int> >}' to non-scalar type 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' requested set<pair<int,int> >::iterator it=S[path].lower_bound({dist,0}); ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ race.cpp:44:22: error: no match for 'operator!=' (operand types are 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' and 'std::set<std::pair<long long int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<long long int, int> >}') if(it!=S[path].end() && (*it).first==dist) ~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/7/set:60:0, from race.cpp:3: /usr/include/c++/7/bits/stl_tree.h:398:7: note: candidate: bool std::_Rb_tree_const_iterator<_Tp>::operator!=(const _Self&) const [with _Tp = std::pair<int, int>; std::_Rb_tree_const_iterator<_Tp>::_Self = std::_Rb_tree_const_iterator<std::pair<int, int> >] operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT ^~~~~~~~ /usr/include/c++/7/bits/stl_tree.h:398:7: note: no known conversion for argument 1 from 'std::set<std::pair<long long int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<long long int, int> >}' to 'const _Self& {aka const std::_Rb_tree_const_iterator<std::pair<int, int> >&}' In file included from /usr/include/c++/7/bits/stl_algobase.h:64:0, from /usr/include/c++/7/vector:60, from race.cpp:2: /usr/include/c++/7/bits/stl_pair.h:456:5: note: candidate: template<class _T1, class _T2> constexpr bool std::operator!=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) ^~~~~~~~ /usr/include/c++/7/bits/stl_pair.h:456:5: note: template argument deduction/substitution failed: race.cpp:44:36: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::pair<_T1, _T2>' if(it!=S[path].end() && (*it).first==dist) ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/vector:60, from race.cpp:2: /usr/include/c++/7/bits/stl_iterator.h:311:5: note: candidate: template<class _Iterator> bool std::operator!=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&) operator!=(const reverse_iterator<_Iterator>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:311:5: note: template argument deduction/substitution failed: race.cpp:44:36: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::reverse_iterator<_Iterator>' if(it!=S[path].end() && (*it).first==dist) ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/vector:60, from race.cpp:2: /usr/include/c++/7/bits/stl_iterator.h:349:5: note: candidate: template<class _IteratorL, class _IteratorR> bool std::operator!=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&) operator!=(const reverse_iterator<_IteratorL>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:349:5: note: template argument deduction/substitution failed: race.cpp:44:36: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::reverse_iterator<_Iterator>' if(it!=S[path].end() && (*it).first==dist) ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/vector:60, from race.cpp:2: /usr/include/c++/7/bits/stl_iterator.h:1130:5: note: candidate: template<class _IteratorL, class _IteratorR> bool std::operator!=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&) operator!=(const move_iterator<_IteratorL>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:1130:5: note: template argument deduction/substitution failed: race.cpp:44:36: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::move_iterator<_IteratorL>' if(it!=S[path].end() && (*it).first==dist) ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/vector:60, from race.cpp:2: /usr/include/c++/7/bits/stl_iterator.h:1136:5: note: candidate: template<class _Iterator> bool std::operator!=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&) operator!=(const move_iterator<_Iterator>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:1136:5: note: template argument deduction/substitution failed: race.cpp:44:36: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::move_iterator<_IteratorL>' if(it!=S[path].end() && (*it).first==dist) ^ In file included from /usr/include/c++/7/vector:61:0, from race.cpp:2: /usr/include/c++/7/bits/allocator.h:158:5: note: candidate: template<class _T1, class _T2> bool std::operator!=(const std::allocator<_Tp1>&, const std::allocator<_T2>&) operator!=(const allocator<_T1>&, const allocator<_T2>&) ^~~~~~~~ /usr/include/c++/7/bits/allocator.h:158:5: note: template argument deduction/substitution failed: race.cpp:44:36: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::allocator<_Tp1>' if(it!=S[path].end() && (*it).first==dist) ^ In file included from /usr/include/c++/7/vector:61:0, from race.cpp:2: /usr/include/c++/7/bits/allocator.h:164:5: note: candidate: template<class _Tp> bool std::operator!=(const std::allocator<_Tp1>&, const std::allocator<_Tp1>&) operator!=(const allocator<_Tp>&, const allocator<_Tp>&) ^~~~~~~~ /usr/include/c++/7/bits/allocator.h:164:5: note: template argument deduction/substitution failed: race.cpp:44:36: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::allocator<_Tp1>' if(it!=S[path].end() && (*it).first==dist) ^ In file included from /usr/include/c++/7/vector:64:0, from race.cpp:2: /usr/include/c++/7/bits/stl_vector.h:1620:5: note: candidate: template<class _Tp, class _Alloc> bool std::operator!=(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&) operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) ^~~~~~~~ /usr/include/c++/7/bits/stl_vector.h:1620:5: note: template argument deduction/substitution failed: race.cpp:44:36: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::vector<_Tp, _Alloc>' if(it!=S[path].end() && (*it).first==dist) ^ In file included from /usr/include/c++/7/set:60:0, from race.cpp:3: /usr/include/c++/7/bits/stl_tree.h:412:5: note: candidate: template<class _Val> bool std::operator!=(const std::_Rb_tree_iterator<_Tp>&, const std::_Rb_tree_const_iterator<_Val>&) operator!=(const _Rb_tree_iterator<_Val>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_tree.h:412:5: note: template argument deduction/substitution failed: race.cpp:44:36: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::_Rb_tree_iterator<_Tp>' if(it!=S[path].end() && (*it).first==dist) ^ In file included from /usr/include/c++/7/set:60:0, from race.cpp:3: /usr/include/c++/7/bits/stl_tree.h:1553:5: note: candidate: template<class _Key, class _Val, class _KeyOfValue, class _Compare, class _Alloc> bool std::operator!=(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&, const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&) operator!=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_tree.h:1553:5: note: template argument deduction/substitution failed: race.cpp:44:36: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>' if(it!=S[path].end() && (*it).first==dist) ^ In file included from /usr/include/c++/7/set:61:0, from race.cpp:3: /usr/include/c++/7/bits/stl_set.h:937:5: note: candidate: template<class _Key, class _Compare, class _Alloc> bool std::operator!=(const std::set<_Key, _Compare, _Alloc>&, const std::set<_Key, _Compare, _Alloc>&) operator!=(const set<_Key, _Compare, _Alloc>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_set.h:937:5: note: template argument deduction/substitution failed: race.cpp:44:36: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::set<_Key, _Compare, _Alloc>' if(it!=S[path].end() && (*it).first==dist) ^ In file included from /usr/include/c++/7/set:62:0, from race.cpp:3: /usr/include/c++/7/bits/stl_multiset.h:920:5: note: candidate: template<class _Key, class _Compare, class _Alloc> bool std::operator!=(const std::multiset<_Key, _Compare, _Alloc>&, const std::multiset<_Key, _Compare, _Alloc>&) operator!=(const multiset<_Key, _Compare, _Alloc>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_multiset.h:920:5: note: template argument deduction/substitution failed: race.cpp:44:36: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::multiset<_Key, _Compare, _Alloc>' if(it!=S[path].end() && (*it).first==dist) ^ race.cpp:48:65: error: conversion from 'std::set<std::pair<long long int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<long long int, int> >}' to non-scalar type 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' requested set<pair<int,int> >::iterator it=S[path].lower_bound({el.first,0}); ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ race.cpp:49:18: error: no match for 'operator!=' (operand types are 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' and 'std::set<std::pair<long long int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<long long int, int> >}') if(it!=S[path].end() && (*it).first==el.first) ~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/7/set:60:0, from race.cpp:3: /usr/include/c++/7/bits/stl_tree.h:398:7: note: candidate: bool std::_Rb_tree_const_iterator<_Tp>::operator!=(const _Self&) const [with _Tp = std::pair<int, int>; std::_Rb_tree_const_iterator<_Tp>::_Self = std::_Rb_tree_const_iterator<std::pair<int, int> >] operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT ^~~~~~~~ /usr/include/c++/7/bits/stl_tree.h:398:7: note: no known conversion for argument 1 from 'std::set<std::pair<long long int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<long long int, int> >}' to 'const _Self& {aka const std::_Rb_tree_const_iterator<std::pair<int, int> >&}' In file included from /usr/include/c++/7/bits/stl_algobase.h:64:0, from /usr/include/c++/7/vector:60, from race.cpp:2: /usr/include/c++/7/bits/stl_pair.h:456:5: note: candidate: template<class _T1, class _T2> constexpr bool std::operator!=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) ^~~~~~~~ /usr/include/c++/7/bits/stl_pair.h:456:5: note: template argument deduction/substitution failed: race.cpp:49:32: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::pair<_T1, _T2>' if(it!=S[path].end() && (*it).first==el.first) ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/vector:60, from race.cpp:2: /usr/include/c++/7/bits/stl_iterator.h:311:5: note: candidate: template<class _Iterator> bool std::operator!=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&) operator!=(const reverse_iterator<_Iterator>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:311:5: note: template argument deduction/substitution failed: race.cpp:49:32: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::reverse_iterator<_Iterator>' if(it!=S[path].end() && (*it).first==el.first) ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/vector:60, from race.cpp:2: /usr/include/c++/7/bits/stl_iterator.h:349:5: note: candidate: template<class _IteratorL, class _IteratorR> bool std::operator!=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&) operator!=(const reverse_iterator<_IteratorL>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:349:5: note: template argument deduction/substitution failed: race.cpp:49:32: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::reverse_iterator<_Iterator>' if(it!=S[path].end() && (*it).first==el.first) ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/vector:60, from race.cpp:2: /usr/include/c++/7/bits/stl_iterator.h:1130:5: note: candidate: template<class _IteratorL, class _IteratorR> bool std::operator!=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&) operator!=(const move_iterator<_IteratorL>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:1130:5: note: template argument deduction/substitution failed: race.cpp:49:32: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::move_iterator<_IteratorL>' if(it!=S[path].end() && (*it).first==el.first) ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/vector:60, from race.cpp:2: /usr/include/c++/7/bits/stl_iterator.h:1136:5: note: candidate: template<class _Iterator> bool std::operator!=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&) operator!=(const move_iterator<_Iterator>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:1136:5: note: template argument deduction/substitution failed: race.cpp:49:32: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::move_iterator<_IteratorL>' if(it!=S[path].end() && (*it).first==el.first) ^ In file included from /usr/include/c++/7/vector:61:0, from race.cpp:2: /usr/include/c++/7/bits/allocator.h:158:5: note: candidate: template<class _T1, class _T2> bool std::operator!=(const std::allocator<_Tp1>&, const std::allocator<_T2>&) operator!=(const allocator<_T1>&, const allocator<_T2>&) ^~~~~~~~ /usr/include/c++/7/bits/allocator.h:158:5: note: template argument deduction/substitution failed: race.cpp:49:32: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::allocator<_Tp1>' if(it!=S[path].end() && (*it).first==el.first) ^ In file included from /usr/include/c++/7/vector:61:0, from race.cpp:2: /usr/include/c++/7/bits/allocator.h:164:5: note: candidate: template<class _Tp> bool std::operator!=(const std::allocator<_Tp1>&, const std::allocator<_Tp1>&) operator!=(const allocator<_Tp>&, const allocator<_Tp>&) ^~~~~~~~ /usr/include/c++/7/bits/allocator.h:164:5: note: template argument deduction/substitution failed: race.cpp:49:32: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::allocator<_Tp1>' if(it!=S[path].end() && (*it).first==el.first) ^ In file included from /usr/include/c++/7/vector:64:0, from race.cpp:2: /usr/include/c++/7/bits/stl_vector.h:1620:5: note: candidate: template<class _Tp, class _Alloc> bool std::operator!=(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&) operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) ^~~~~~~~ /usr/include/c++/7/bits/stl_vector.h:1620:5: note: template argument deduction/substitution failed: race.cpp:49:32: note: 'std::set<std::pair<int, int> >::iterator {aka std::_Rb_tree_const_iterator<std::pair<int, int> >}' is not derived from 'const std::vector<_Tp, _Alloc>' if(it!=S[path].end() && (*it).first==el.first) ^ In file included from /usr/incl