# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1197075 | aykhn | Growing Vegetable is Fun 3 (JOI19_ho_t3) | C++20 | 컴파일 에러 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
#define inf 0x3F3F3F3F
const int MXN = 4e2 + 5;
int dp[MXN][MXN][MXN][3];
void _()
{
int n;
cin >> n;
int a[n + 1];
vector<int> idx[3] = {{0}, {0}, {0}};
vector<int> up[3][3];
for (int i = 1; i <= n; i++)
{
char ch;
cin >> ch;
a[i] = (ch == 'R' ? 0 : ch == 'G' ? 1 : 2);
idx[a[i]].push_back(i);
}
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
for (int &k : idx[i])
{
up[i][j].push_back(upper_bound(idx[j].begin(), idx[j].end(), k) - idx[j].begin());
}
}
}
for (int i = 0; i < MXN; i++) for (int j = 0; j < MXN; j++) for (int k = 0; k < MXN; k++) for (int l = 0; l < 3; l++) dp[i][j][k][l] = inf;
if (idx[0].size() > 1) dp[1][0][0][0] = idx[0][1] - 1;
if (idx[1].size() > 1) dp[0][1][0][1] = idx[1][1] - 1;
if (idx[2].size() > 1) dp[0][0][1][2] = idx[2][1] - 1;
for (int all = 1; all < n; all++)
{
for (int a = 0; a < idx[0].size(); a++)
{
for (int b = 0; b < idx[1].size(); b++)
{
int c = all - a - b;
if (c >= idx[2].size()) continue;
for (int l = 0; l < 3; l++)
{
if (l != 0 && a + 1 < idx[0].size())
{
int val = max(0LL, up[0][1][a + 1] - b - 1) + max(0LL, up[0][2][a + 1] - c - 1);
dp[a + 1][b][c][0] = min(dp[a + 1][b][c][0], dp[a][b][c][l] + val);
}
if (l != 1 && b + 1 < idx[1].size())
{
int val = max(0LL, up[1][0][b + 1] - a - 1) + max(0LL, up[1][2][b + 1] - c - 1);
dp[a][b + 1][c][1] = min(dp[a][b + 1][c][1], dp[a][b][c][l] + val);
}
if (l != 2 && c + 1 < idx[2].size())
{
int val = max(0LL, up[2][0][c + 1] - a - 1) + max(0LL, up[2][1][c + 1] - b - 1);
dp[a][b][c + 1][2] = min(dp[a][b][c + 1][2], dp[a][b][c][l] + val);
}
}
}
}
}
int res = *min_element(dp[(int)idx[0].size() - 1][(int)idx[1].size() - 1][(int)idx[2].size() - 1], dp[(int)idx[0].size() - 1][(int)idx[1].size() - 1][(int)idx[2].size() - 1] + 3);
cout << (res >= inf ? -1 : res) << '\n';
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1;
// cin >> t;
while (t--) _();
}
컴파일 시 표준 에러 (stderr) 메시지
joi2019_ho_t3.cpp: In function 'void _()': joi2019_ho_t3.cpp:51:26: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 51 | int val = max(0LL, up[0][1][a + 1] - b - 1) + max(0LL, up[0][2][a + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:51:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 51 | int val = max(0LL, up[0][1][a + 1] - b - 1) + max(0LL, up[0][2][a + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:51:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 51 | int val = max(0LL, up[0][1][a + 1] - b - 1) + max(0LL, up[0][2][a + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included 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 joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3461 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3461:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:51:26: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 51 | int val = max(0LL, up[0][1][a + 1] - b - 1) + max(0LL, up[0][2][a + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included 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 joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3467:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:51:26: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 51 | int val = max(0LL, up[0][1][a + 1] - b - 1) + max(0LL, up[0][2][a + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ joi2019_ho_t3.cpp:51:62: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 51 | int val = max(0LL, up[0][1][a + 1] - b - 1) + max(0LL, up[0][2][a + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:51:62: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 51 | int val = max(0LL, up[0][1][a + 1] - b - 1) + max(0LL, up[0][2][a + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:51:62: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 51 | int val = max(0LL, up[0][1][a + 1] - b - 1) + max(0LL, up[0][2][a + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included 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 joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3461 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3461:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:51:62: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 51 | int val = max(0LL, up[0][1][a + 1] - b - 1) + max(0LL, up[0][2][a + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included 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 joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3467:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:51:62: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 51 | int val = max(0LL, up[0][1][a + 1] - b - 1) + max(0LL, up[0][2][a + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ joi2019_ho_t3.cpp:56:26: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 56 | int val = max(0LL, up[1][0][b + 1] - a - 1) + max(0LL, up[1][2][b + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:56:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 56 | int val = max(0LL, up[1][0][b + 1] - a - 1) + max(0LL, up[1][2][b + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:56:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 56 | int val = max(0LL, up[1][0][b + 1] - a - 1) + max(0LL, up[1][2][b + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included 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 joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3461 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3461:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:56:26: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 56 | int val = max(0LL, up[1][0][b + 1] - a - 1) + max(0LL, up[1][2][b + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included 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 joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3467:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:56:26: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 56 | int val = max(0LL, up[1][0][b + 1] - a - 1) + max(0LL, up[1][2][b + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ joi2019_ho_t3.cpp:56:62: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 56 | int val = max(0LL, up[1][0][b + 1] - a - 1) + max(0LL, up[1][2][b + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:56:62: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 56 | int val = max(0LL, up[1][0][b + 1] - a - 1) + max(0LL, up[1][2][b + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:56:62: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 56 | int val = max(0LL, up[1][0][b + 1] - a - 1) + max(0LL, up[1][2][b + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included 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 joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3461 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3461:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:56:62: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 56 | int val = max(0LL, up[1][0][b + 1] - a - 1) + max(0LL, up[1][2][b + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included 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 joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3467:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:56:62: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 56 | int val = max(0LL, up[1][0][b + 1] - a - 1) + max(0LL, up[1][2][b + 1] - c - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ joi2019_ho_t3.cpp:61:26: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 61 | int val = max(0LL, up[2][0][c + 1] - a - 1) + max(0LL, up[2][1][c + 1] - b - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:61:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 61 | int val = max(0LL, up[2][0][c + 1] - a - 1) + max(0LL, up[2][1][c + 1] - b - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:61:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 61 | int val = max(0LL, up[2][0][c + 1] - a - 1) + max(0LL, up[2][1][c + 1] - b - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included 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 joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3461 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3461:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:61:26: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 61 | int val = max(0LL, up[2][0][c + 1] - a - 1) + max(0LL, up[2][1][c + 1] - b - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included 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 joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3467:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:61:26: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 61 | int val = max(0LL, up[2][0][c + 1] - a - 1) + max(0LL, up[2][1][c + 1] - b - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ joi2019_ho_t3.cpp:61:62: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 61 | int val = max(0LL, up[2][0][c + 1] - a - 1) + max(0LL, up[2][1][c + 1] - b - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:61:62: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 61 | int val = max(0LL, up[2][0][c + 1] - a - 1) + max(0LL, up[2][1][c + 1] - b - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:61:62: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 61 | int val = max(0LL, up[2][0][c + 1] - a - 1) + max(0LL, up[2][1][c + 1] - b - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included 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 joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3461 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3461:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:61:62: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 61 | int val = max(0LL, up[2][0][c + 1] - a - 1) + max(0LL, up[2][1][c + 1] - b - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included 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 joi2019_ho_t3.cpp:1: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/11/bits/stl_algo.h:3467:5: note: template argument deduction/substitution failed: joi2019_ho_t3.cpp:61:62: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 61 | int val = max(0LL, up[2][0][c + 1] - a - 1) + max(0LL, up[2][1][c + 1] - b - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~