Borderou de evaluare (job #3169309)

Utilizator andrei_marciucMarciuc Andrei andrei_marciuc Data 14 noiembrie 2023 19:24:24
Problema PetSoft Status done
Runda Arhiva de probleme Compilator cpp-64 | Vezi sursa
Scor 0

Raport evaluator

Eroare de compilare: main.cpp: In function 'int solve(int)': main.cpp:20:5: error: 'sort' was not declared in this scope; did you mean 'short'? 20 | sort(val + 1, val + n + 1); | ^~~~ | short main.cpp:29:29: error: no matching function for call to 'max(<brace-enclosed initializer list>)' 29 | cost[l][r] = max({cost[l + 1][r - 1] + abs(x - y) + dp[x][0] + dp[y][0], | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 30 | cost[l + 1][r] + max(dp[x][0], dp[x][1]), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 31 | cost[l][r - 1] + max(dp[y][0], dp[y][1])}); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/12.2.1/string:50, from /usr/include/c++/12.2.1/bits/locale_classes.h:40, from /usr/include/c++/12.2.1/bits/ios_base.h:41, from /usr/include/c++/12.2.1/ios:42, from /usr/include/c++/12.2.1/istream:38, from /usr/include/c++/12.2.1/fstream:38, from main.cpp:1: /usr/include/c++/12.2.1/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++/12.2.1/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: main.cpp:29:29: note: candidate expects 2 arguments, 1 provided 29 | cost[l][r] = max({cost[l + 1][r - 1] + abs(x - y) + dp[x][0] + dp[y][0], | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 30 | cost[l + 1][r] + max(dp[x][0], dp[x][1]), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 31 | cost[l][r - 1] + max(dp[y][0], dp[y][1])}); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/12.2.1/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++/12.2.1/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: main.cpp:29:29: note: candidate expects 3 arguments, 1 provided 29 | cost[l][r] = max({cost[l + 1][r - 1] + abs(x - y) + dp[x][0] + dp[y][0], | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 30 | cost[l + 1][r] + max(dp[x][0], dp[x][1]), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 31 | cost[l][r - 1] + max(dp[y][0], dp[y][1])}); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Non zero exit status: 1

Ceva nu functioneaza?