building.cpp: In function 'int main()':
building.cpp:42:14: error: 'i' was not declared in this scope
42 | dp[1] = -w[i];
| ^
building.cpp:47:46: error: no matching function for call to 'accumulate(int*, int*)'
47 | cout << dp[n] + accumulate(w + 1, w + n + 1) << '\n';
| ^
In file included from /usr/include/c++/10/numeric:62,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:84,
from building.cpp:1:
/usr/include/c++/10/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
134 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
| ^~~~~~~~~~
/usr/include/c++/10/bits/stl_numeric.h:134:5: note: template argument deduction/substitution failed:
building.cpp:47:46: note: candidate expects 3 arguments, 2 provided
47 | cout << dp[n] + accumulate(w + 1, w + n + 1) << '\n';
| ^
In file included from /usr/include/c++/10/numeric:62,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:84,
from building.cpp:1:
/usr/include/c++/10/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
161 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
| ^~~~~~~~~~
/usr/include/c++/10/bits/stl_numeric.h:161:5: note: template argument deduction/substitution failed:
building.cpp:47:46: note: candidate expects 4 arguments, 2 provided
47 | cout << dp[n] + accumulate(w + 1, w + n + 1) << '\n';
| ^