#2273
ssplit
Se consideră un șir a[1]
, a[2]
, …, a[n]
de numere naturale nenule. Pentru doi indici 1 ≤ i < j < n
, notăm cu X = a[1] + a[2] + ... + a[i]
, Y = a[i+1] + a[i+2] + ... + a[j]
și Z = a[j+1] + a[j+2] + ... + a[n]
. Să se determine doi indici i
și j
astfel încât diferența max(X, Y, Z) - min(X, Y, Z)
să fie minimă.
Problema | ssplit | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53144406 | Utilizator | |
Fișier | ssplit.cpp | Dimensiune | 1.47 KB |
Data încărcării | 18 Octombrie 2024, 21:44 | Scor / rezultat | Eroare de compilare |
ssplit.cpp: In function 'int main()': ssplit.cpp:30:46: error: no matching function for call to 'max(<brace-enclosed initializer list>)' long long max_sum = max({X, Y, Z}); ^ ssplit.cpp:30:46: note: candidates are: In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from ssplit.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template argument deduction/substitution failed: ssplit.cpp:30:46: note: candidate expects 2 arguments, 1 provided long long max_sum = max({X, Y, Z}); ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from ssplit.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template argument deduction/substitution failed: ssplit.cpp:30:46: note: candidate expects 3 arguments, 1 provided long long max_sum = max({X, Y, Z}); ^ ssplit.cpp:31:46: error: no matching function for call to 'min(<brace-enclosed initializer list>)' long long min_sum = min({X, Y, Z}); ^ ssplit.cpp:31:46: note: candidates are: In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from ssplit.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: ssplit.cpp:31:46: note: candidate expects 2 arguments, 1 provided long long min_sum = min({X, Y, Z}); ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from ssplit.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: ssplit.cpp:31:46: note: candidate expects 3 arguments, 1 provided long long min_sum = min({X, Y, Z}); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ssplit face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.