| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1263273 | DeltaStruct | Traffic (IOI10_traffic) | C++20 | Compilation error | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
int res = 2e9;
int dfs(vector<vector<int>>& G,int x,int p,int s,int A[]){
int m = 0,r = s-A[x]; for (int y:G[x]) if (y!=p){
int t = dfs(G,y,x,s,A); r -= t,m = max(m,t);
}
res = min(res,max(m,r));
return s-r;
}
int LocateCentre(int n,int A[],int B[],int C[]){
vector<vector<int>> G(n); for (int i(0);i < n-1;++i) G[B[i]].emplace_back(C[i]),G[C[i]].emplace_back(B[i]);
dfs(G,0,-1,accumulate(begin(A),end(A),0),A);
return res;
}
Compilation message (stderr)
traffic.cpp: In function 'int LocateCentre(int, int*, int*, int*)':
traffic.cpp:15:30: error: no matching function for call to 'begin(int*&)'
15 | dfs(G,0,-1,accumulate(begin(A),end(A),0),A);
| ~~~~~^~~
In file included from /usr/include/c++/11/bits/algorithmfwd.h:39,
from /usr/include/c++/11/bits/stl_algo.h:60,
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 traffic.cpp:1:
/usr/include/c++/11/initializer_list:90:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>)'
90 | begin(initializer_list<_Tp> __ils) noexcept
| ^~~~~
/usr/include/c++/11/initializer_list:90:5: note: template argument deduction/substitution failed:
traffic.cpp:15:30: note: mismatched types 'std::initializer_list<_Tp>' and 'int*'
15 | dfs(G,0,-1,accumulate(begin(A),end(A),0),A);
| ~~~~~^~~
In file included from /usr/include/c++/11/string:54,
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 traffic.cpp:1:
/usr/include/c++/11/bits/range_access.h:51:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)'
51 | begin(_Container& __cont) -> decltype(__cont.begin())
| ^~~~~
/usr/include/c++/11/bits/range_access.h:51:5: note: template argument deduction/substitution failed:
/usr/include/c++/11/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&) [with _Container = int*]':
traffic.cpp:15:30: required from here
/usr/include/c++/11/bits/range_access.h:51:50: error: request for member 'begin' in '__cont', which is of non-class type 'int*'
51 | begin(_Container& __cont) -> decltype(__cont.begin())
| ~~~~~~~^~~~~
/usr/include/c++/11/bits/range_access.h:61:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)'
61 | begin(const _Container& __cont) -> decltype(__cont.begin())
| ^~~~~
/usr/include/c++/11/bits/range_access.h:61:5: note: template argument deduction/substitution failed:
/usr/include/c++/11/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&) [with _Container = int*]':
traffic.cpp:15:30: required from here
/usr/include/c++/11/bits/range_access.h:61:56: error: request for member 'begin' in '__cont', which is of non-class type 'int* const'
61 | begin(const _Container& __cont) -> decltype(__cont.begin())
| ~~~~~~~^~~~~
/usr/include/c++/11/bits/range_access.h:90:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])'
90 | begin(_Tp (&__arr)[_Nm]) noexcept
| ^~~~~
/usr/include/c++/11/bits/range_access.h:90:5: note: template argument deduction/substitution failed:
traffic.cpp:15:30: note: mismatched types '_Tp [_Nm]' and 'int*'
15 | dfs(G,0,-1,accumulate(begin(A),end(A),0),A);
| ~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
from traffic.cpp:1:
/usr/include/c++/11/valarray:1217:5: note: candidate: 'template<class _Tp> _Tp* std::begin(std::valarray<_Tp>&)'
1217 | begin(valarray<_Tp>& __va) noexcept
| ^~~~~
/usr/include/c++/11/valarray:1217:5: note: template argument deduction/substitution failed:
traffic.cpp:15:30: note: mismatched types 'std::valarray<_Tp>' and 'int*'
15 | dfs(G,0,-1,accumulate(begin(A),end(A),0),A);
| ~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
from traffic.cpp:1:
/usr/include/c++/11/valarray:1228:5: note: candidate: 'template<class _Tp> const _Tp* std::begin(const std::valarray<_Tp>&)'
1228 | begin(const valarray<_Tp>& __va) noexcept
| ^~~~~
/usr/include/c++/11/valarray:1228:5: note: template argument deduction/substitution failed:
traffic.cpp:15:30: note: mismatched types 'const std::valarray<_Tp>' and 'int*'
15 | dfs(G,0,-1,accumulate(begin(A),end(A),0),A);
| ~~~~~^~~
traffic.cpp:15:37: error: no matching function for call to 'end(int*&)'
15 | dfs(G,0,-1,accumulate(begin(A),end(A),0),A);
| ~~~^~~
In file included from /usr/include/c++/11/bits/algorithmfwd.h:39,
from /usr/include/c++/11/bits/stl_algo.h:60,
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 traffic.cpp:1:
/usr/include/c++/11/initializer_list:101:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>)'
101 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
/usr/include/c++/11/initializer_list:101:5: note: template argument deduction/substitution failed:
traffic.cpp:15:37: note: mismatched types 'std::initializer_list<_Tp>' and 'int*'
15 | dfs(G,0,-1,accumulate(begin(A),end(A),0),A);
| ~~~^~~
In file included from /usr/include/c++/11/string:54,
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 traffic.cpp:1:
/usr/include/c++/11/bits/range_access.h:71:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
71 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/11/bits/range_access.h:71:5: note: template argument deduction/substitution failed:
/usr/include/c++/11/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&) [with _Container = int*]':
traffic.cpp:15:37: required from here
/usr/include/c++/11/bits/range_access.h:71:48: error: request for member 'end' in '__cont', which is of non-class type 'int*'
71 | end(_Container& __cont) -> decltype(__cont.end())
| ~~~~~~~^~~
/usr/include/c++/11/bits/range_access.h:81:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
81 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/11/bits/range_access.h:81:5: note: template argument deduction/substitution failed:
/usr/include/c++/11/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&) [with _Container = int*]':
traffic.cpp:15:37: required from here
/usr/include/c++/11/bits/range_access.h:81:54: error: request for member 'end' in '__cont', which is of non-class type 'int* const'
81 | end(const _Container& __cont) -> decltype(__cont.end())
| ~~~~~~~^~~
/usr/include/c++/11/bits/range_access.h:100:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
100 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/11/bits/range_access.h:100:5: note: template argument deduction/substitution failed:
traffic.cpp:15:37: note: mismatched types '_Tp [_Nm]' and 'int*'
15 | dfs(G,0,-1,accumulate(begin(A),end(A),0),A);
| ~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
from traffic.cpp:1:
/usr/include/c++/11/valarray:1239:5: note: candidate: 'template<class _Tp> _Tp* std::end(std::valarray<_Tp>&)'
1239 | end(valarray<_Tp>& __va) noexcept
| ^~~
/usr/include/c++/11/valarray:1239:5: note: template argument deduction/substitution failed:
traffic.cpp:15:37: note: mismatched types 'std::valarray<_Tp>' and 'int*'
15 | dfs(G,0,-1,accumulate(begin(A),end(A),0),A);
| ~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
from traffic.cpp:1:
/usr/include/c++/11/valarray:1255:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const std::valarray<_Tp>&)'
1255 | end(const valarray<_Tp>& __va) noexcept
| ^~~
/usr/include/c++/11/valarray:1255:5: note: template argument deduction/substitution failed:
traffic.cpp:15:37: note: mismatched types 'const std::valarray<_Tp>' and 'int*'
15 | dfs(G,0,-1,accumulate(begin(A),end(A),0),A);
| ~~~^~~