#1637
Split
Fie un șir de numere naturale. Se împarte şirul în patru secvenţe astfel încât orice element din şir să aparţină unei singure secvenţe şi fiecare secvenţă să conţină cel puţin două elemente. Pentru fiecare secvenţă se determină costul ei ca fiind diferenţa dintre valoarea maximă şi cea minimă din acea secvenţă.
ONI 2013, Clasa a IX-a
Problema | Split | Operații I/O |
split.in /split.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 16 MB
/
Stivă 8 MB
|
Id soluție | #51582085 | Utilizator | |
Fișier | split.cpp | Dimensiune | 1.82 KB |
Data încărcării | 16 Iulie 2024, 02:21 | Scor / rezultat | Eroare de compilare |
split.cpp: In function 'int main()': split.cpp:39:31: error: no matching function for call to 'max(int&, long long int&)' maxi=max(maxi,v[i]); ^ split.cpp:39:31: 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/istream:38, from /usr/include/c++/4.8/fstream:38, from split.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: split.cpp:39:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') maxi=max(maxi,v[i]); ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from split.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: split.cpp:39:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') maxi=max(maxi,v[i]); ^ split.cpp:40:31: error: no matching function for call to 'min(int&, long long int&)' mini=min(mini,v[i]); ^ split.cpp:40:31: 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/istream:38, from /usr/include/c++/4.8/fstream:38, from split.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: split.cpp:40:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') mini=min(mini,v[i]); ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from split.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: split.cpp:40:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') mini=min(mini,v[i]); ^ split.cpp:51:31: error: no matching function for call to 'max(int&, long long int&)' maxk=max(maxk,v[k]); ^ split.cpp:51:31: 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/istream:38, from /usr/include/c++/4.8/fstream:38, from split.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: split.cpp:51:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') maxk=max(maxk,v[k]); ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from split.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: split.cpp:51:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') maxk=max(maxk,v[k]); ^ split.cpp:52:31: error: no matching function for call to 'min(int&, long long int&)' mink=min(mink,v[k]); ^ split.cpp:52:31: 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/istream:38, from /usr/include/c++/4.8/fstream:38, from split.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: split.cpp:52:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') mink=min(mink,v[k]); ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from split.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: split.cpp:52:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') mink=min(mink,v[k]); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Split 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ă.