| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1250335 | Wayne_Yan | Souvenirs (IOI25_souvenirs) | C++20 | 컴파일 에러 | 0 ms | 0 KiB |
#include "souvenirs.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct dat {
vector<int> counts;
ll total_price;
bool operator<(const dat &b) {
return lexicographical_compare(counts.begin(), counts.end(),
b.counts.begin(), b.counts.end());
}
void reduce(dat d) {
assert(d.counts.size() == 1);
for (int i = 0; i < (int)counts.size(); i++) {
if (counts[i] == d.counts[0]) {
total_price -= d.total_price;
counts.erase(counts.begin() + i);
break;
}
}
}
};
void buy_souvenirs(int n, long long p0) {
vector<int> count(n);
vector<dat> st;
vector<dat> done;
vector<ll> ans(n);
auto calc_next_transaction = [&](dat x) {
int fst = x.counts[0];
int lst = x.counts[x.counts.size() - 1];
for (int i = lst - 1; i > fst; i--) {
if (ans[i] != 0)
return ans[i] - 1;
}
return (x.total_price - 1) / (int)x.counts.size();
};
auto get_dat = [&](ll x) {
auto [rest, v] = transaction(x);
for (int i : v)
count[i]++;
for (int i = (int)v.size() - 1; i >= 0; i--) {
if (ans[v[i]] != 0) {
rest += ans[v[i]];
v.erase(v.begin() + i);
}
}
dat res;
res.counts = v;
res.total_price = x - rest;
return res;
};
ans[0] = p0;
while (true) {
int idx = -1;
for (int i = 0; i < n; i++) {
if (ans[i] == 0) {
idx = i;
break;
}
}
if (idx == -1)
break;
auto process = [&](ll x) {
st.push_back(get_dat(x));
for (int i = (int)st.size() - 1; i >= 0; i--) {
if (st[i].counts.size() == 1) {
ans[st[i].counts[0]] = st[i].total_price;
done.push_back(st[i]);
st.erase(st.begin() + i);
}
}
while (!done.empty()) {
auto d = done.back();
done.pop_back();
for (int i = (int)st.size() - 1; i >= 0; i--) {
st[i].reduce(d);
if (st[i].counts.size() == 1) {
ans[st[i].counts[0]] = st[i].total_price;
done.push_back(st[i]);
st.erase(st.begin() + i);
}
}
}
};
process(ans[idx - 1] - 1);
while (!st.empty()) {
sort(st.rbegin(), st.rend());
auto fst = st[0];
ll next_transaction = calc_next_transaction(fst);
process(next_transaction);
}
}
for (int i = 1; i < n; i++) {
while (count[i] < i) {
transaction(ans[i]);
count[i]++;
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
souvenirs.cpp: In lambda function:
souvenirs.cpp:46:18: error: 'begin' was not declared in this scope
46 | for (int i : v)
| ^
souvenirs.cpp:46:18: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
from souvenirs.cpp:2:
/usr/include/c++/11/valarray:1228:5: note: 'std::begin'
1228 | begin(const valarray<_Tp>& __va) noexcept
| ^~~~~
In file included from /usr/include/c++/11/string_view:48,
from /usr/include/c++/11/bits/basic_string.h:48,
from /usr/include/c++/11/string:55,
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 souvenirs.cpp:2:
/usr/include/c++/11/bits/ranges_base.h:561:44: note: 'std::ranges::__cust::begin'
561 | inline constexpr __cust_access::_Begin begin{};
| ^~~~~
In file included from /usr/include/c++/11/filesystem:46,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:129,
from souvenirs.cpp:2:
/usr/include/c++/11/bits/fs_dir.h:549:3: note: 'std::filesystem::__cxx11::begin'
549 | begin(recursive_directory_iterator __iter) noexcept
| ^~~~~
In file included from /usr/include/c++/11/bits/stl_iterator_base_types.h:71,
from /usr/include/c++/11/bits/stl_algobase.h:65,
from /usr/include/c++/11/vector:60,
from souvenirs.h:2,
from souvenirs.cpp:1:
/usr/include/c++/11/bits/iterator_concepts.h:949:10: note: 'std::ranges::__cust_access::begin'
949 | void begin(const auto&) = delete;
| ^~~~~
souvenirs.cpp:46:18: error: 'end' was not declared in this scope
46 | for (int i : v)
| ^
souvenirs.cpp:46:18: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
from souvenirs.cpp:2:
/usr/include/c++/11/valarray:1255:5: note: 'std::end'
1255 | end(const valarray<_Tp>& __va) noexcept
| ^~~
In file included from /usr/include/c++/11/string_view:48,
from /usr/include/c++/11/bits/basic_string.h:48,
from /usr/include/c++/11/string:55,
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 souvenirs.cpp:2:
/usr/include/c++/11/bits/ranges_base.h:562:42: note: 'std::ranges::__cust::end'
562 | inline constexpr __cust_access::_End end{};
| ^~~
In file included from /usr/include/c++/11/filesystem:46,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:129,
from souvenirs.cpp:2:
/usr/include/c++/11/bits/fs_dir.h:554:3: note: 'std::filesystem::__cxx11::end'
554 | end(recursive_directory_iterator) noexcept
| ^~~
In file included from /usr/include/c++/11/string_view:48,
from /usr/include/c++/11/bits/basic_string.h:48,
from /usr/include/c++/11/string:55,
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 souvenirs.cpp:2:
/usr/include/c++/11/bits/ranges_base.h:136:10: note: 'std::ranges::__cust_access::end'
136 | void end(const auto&) = delete;
| ^~~
souvenirs.cpp:48:25: error: request for member 'size' in 'v', which is of non-class type 'std::tuple_element<1, std::pair<std::vector<int>, long long int> >::type' {aka 'long long int'}
48 | for (int i = (int)v.size() - 1; i >= 0; i--) {
| ^~~~
souvenirs.cpp:49:16: error: invalid types 'std::tuple_element<1, std::pair<std::vector<int>, long long int> >::type {aka long long int}[int]' for array subscript
49 | if (ans[v[i]] != 0) {
| ^
souvenirs.cpp:50:22: error: invalid types 'std::tuple_element<1, std::pair<std::vector<int>, long long int> >::type {aka long long int}[int]' for array subscript
50 | rest += ans[v[i]];
| ^
souvenirs.cpp:51:11: error: request for member 'erase' in 'v', which is of non-class type 'std::tuple_element<1, std::pair<std::vector<int>, long long int> >::type' {aka 'long long int'}
51 | v.erase(v.begin() + i);
| ^~~~~
souvenirs.cpp:51:19: error: request for member 'begin' in 'v', which is of non-class type 'std::tuple_element<1, std::pair<std::vector<int>, long long int> >::type' {aka 'long long int'}
51 | v.erase(v.begin() + i);
| ^~~~~
souvenirs.cpp:55:18: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'std::tuple_element<1, std::pair<std::vector<int>, long long int> >::type' {aka 'long long int'})
55 | res.counts = v;
| ^
In file included from /usr/include/c++/11/vector:72,
from souvenirs.h:2,
from souvenirs.cpp:1:
/usr/include/c++/11/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
198 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/vector.tcc:199:42: note: no known conversion for argument 1 from 'std::tuple_element<1, std::pair<std::vector<int>, long long int> >::type' {aka 'long long int'} to 'const std::vector<int>&'
199 | operator=(const vector<_Tp, _Alloc>& __x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/11/vector:67,
from souvenirs.h:2,
from souvenirs.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
709 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ^~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:709:26: note: no known conversion for argument 1 from 'std::tuple_element<1, std::pair<std::vector<int>, long long int> >::type' {aka 'long long int'} to 'std::vector<int>&&'
709 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
730 | operator=(initializer_list<value_type> __l)
| ^~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:730:46: note: no known conversion for argument 1 from 'std::tuple_element<1, std::pair<std::vector<int>, long long int> >::type' {aka 'long long int'} to 'std::initializer_list<int>'
730 | operator=(initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
souvenirs.cpp:56:25: error: no match for 'operator-' (operand types are 'll' {aka 'long long int'} and 'std::tuple_element<0, std::pair<std::vector<int>, long long int> >::type' {aka 'std::vector<int>'})
56 | res.total_price = x - rest;
| ~ ^ ~~~~
| | |
| | std::tuple_element<0, std::pair<std::vector<int>, long long int> >::type {aka std::vector<int>}
| ll {aka long long int}
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
from /usr/include/c++/11/vector:60,
from souvenirs.h:2,
from souvenirs.cpp:1:
/usr/include/c++/11/bits/stl_iterator.h:577:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const std::reverse_iterator<_IteratorL>&, const std::reverse_iterator<_IteratorR>&)'
577 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:577:5: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: mismatched types 'const std::reverse_iterator<_IteratorL>' and 'll' {aka 'long long int'}
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
from /usr/include/c++/11/vector:60,
from souvenirs.h:2,
from souvenirs.cpp:1:
/usr/include/c++/11/bits/stl_iterator.h:1693:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
1693 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:1693:5: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'll' {aka 'long long int'}
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/c++/11/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
from souvenirs.cpp:2:
/usr/include/c++/11/complex:362:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const std::complex<_Tp>&)'
362 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/11/complex:362:5: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: mismatched types 'const std::complex<_Tp>' and 'll' {aka 'long long int'}
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/c++/11/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
from souvenirs.cpp:2:
/usr/include/c++/11/complex:371:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const _Tp&)'
371 | operator-(const complex<_Tp>& __x, const _Tp& __y)
| ^~~~~~~~
/usr/include/c++/11/complex:371:5: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: mismatched types 'const std::complex<_Tp>' and 'll' {aka 'long long int'}
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/c++/11/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
from souvenirs.cpp:2:
/usr/include/c++/11/complex:380:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator-(const _Tp&, const std::complex<_Tp>&)'
380 | operator-(const _Tp& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/11/complex:380:5: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: 'std::tuple_element<0, std::pair<std::vector<int>, long long int> >::type' {aka 'std::vector<int>'} is not derived from 'const std::complex<_Tp>'
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/c++/11/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
from souvenirs.cpp:2:
/usr/include/c++/11/complex:457:5: note: candidate: 'template<class _Tp> constexpr std::complex<_Tp> std::operator-(const std::complex<_Tp>&)'
457 | operator-(const complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/11/complex:457:5: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: mismatched types 'const std::complex<_Tp>' and 'll' {aka 'long long int'}
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/c++/11/valarray:603,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
from souvenirs.cpp:2:
/usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'll' {aka 'long long int'}
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/c++/11/valarray:603,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
from souvenirs.cpp:2:
/usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'll' {aka 'long long int'}
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/c++/11/valarray:603,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
from souvenirs.cpp:2:
/usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: 'std::tuple_element<0, std::pair<std::vector<int>, long long int> >::type' {aka 'std::vector<int>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/c++/11/valarray:603,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
from souvenirs.cpp:2:
/usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'll' {aka 'long long int'}
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/c++/11/valarray:603,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
from souvenirs.cpp:2:
/usr/include/c++/11/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: 'std::tuple_element<0, std::pair<std::vector<int>, long long int> >::type' {aka 'std::vector<int>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
from souvenirs.cpp:2:
/usr/include/c++/11/valarray:1187:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const std::valarray<_Tp>&, const std::valarray<_Tp>&)'
1187 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/valarray:1187:1: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: mismatched types 'const std::valarray<_Tp>' and 'll' {aka 'long long int'}
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
from souvenirs.cpp:2:
/usr/include/c++/11/valarray:1187:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const std::valarray<_Tp>&, const typename std::valarray<_Tp>::value_type&)'
1187 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/valarray:1187:1: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: mismatched types 'const std::valarray<_Tp>' and 'll' {aka 'long long int'}
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
from souvenirs.cpp:2:
/usr/include/c++/11/valarray:1187:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename std::valarray<_Tp>::value_type&, const std::valarray<_Tp>&)'
1187 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/valarray:1187:1: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: 'std::tuple_element<0, std::pair<std::vector<int>, long long int> >::type' {aka 'std::vector<int>'} is not derived from 'const std::valarray<_Tp>'
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
from /usr/include/c++/11/vector:60,
from souvenirs.h:2,
from souvenirs.cpp:1:
/usr/include/c++/11/bits/stl_iterator.h:1255:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> constexpr decltype ((__lhs.base() - __rhs.base())) __gnu_cxx::operator-(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)'
1255 | operator-(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:1255:5: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and 'll' {aka 'long long int'}
56 | res.total_price = x - rest;
| ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
from /usr/include/c++/11/vector:60,
from souvenirs.h:2,
from souvenirs.cpp:1:
/usr/include/c++/11/bits/stl_iterator.h:1268:5: note: candidate: 'template<class _Iterator, class _Container> constexpr typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type __gnu_cxx::operator-(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)'
1268 | operator-(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:1268:5: note: template argument deduction/substitution failed:
souvenirs.cpp:56:27: note: mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'll' {aka 'long long int'}
56 | res.total_price = x - rest;
| ^~~~