for (int i = 1; i <= m; i++)
for (int j = 1; j <= n; j++)
for (int k = 1; k <= m; k++)
for (int l = j + 1; l <= n; l++)
f[i][j][k][l] = std::max({f[i - 1][j][k - 1][l], f[i - 1][j][k][l - 1], f[i][j - 1][k - 1][l], f[i][j - 1][k][l - 1]}) + a[i][j] + a[k][l];
在 C++20 中仍然 CE:
/tmp/compiler_6pta8394/src: In function ‘int main()’:
/tmp/compiler_6pta8394/src:22:45: 错误:对‘max(<花括号内的初始值列表>)’的调用没有匹配的函数
22 | f[i][j][k][l] = std::max({f[i - 1][j][k - 1][l], f[i - 1][j][k][l - 1], f[i][j - 1][k - 1][l], f[i][j - 1][k][l - 1]}) + a[i][j] + a[k][l];
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/string:51,
from /nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/bits/locale_classes.h:40,
from /nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/bits/ios_base.h:41,
from /nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/ios:44,
from /nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/ostream:40,
from /nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/iostream:41,
from /tmp/compiler_6pta8394/src:1:
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/bits/stl_algobase.h:257:5: 附注:candidate: ‘template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)’
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/bits/stl_algobase.h:257:5: 附注: template argument deduction/substitution failed:
/tmp/compiler_6pta8394/src:22:45: 附注: 备选需要 2 实参,但提供了 1 个
22 | f[i][j][k][l] = std::max({f[i - 1][j][k - 1][l], f[i - 1][j][k][l - 1], f[i][j - 1][k - 1][l], f[i][j - 1][k][l - 1]}) + a[i][j] + a[k][l];
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/bits/stl_algobase.h:303:5: 附注:candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/nix/store/al0w33yvyzkjm86ndpf42knjfymfisph-luogu-gcc-13.2.0/include/c++/13.2.0/bits/stl_algobase.h:303:5: 附注: template argument deduction/substitution failed:
/tmp/compiler_6pta8394/src:22:45: 附注: 备选需要 3 实参,但提供了 1 个
22 | f[i][j][k][l] = std::max({f[i - 1][j][k - 1][l], f[i - 1][j][k][l - 1], f[i][j - 1][k - 1][l], f[i][j - 1][k][l - 1]}) + a[i][j] + a[k][l];
|