#3511
Bob deține n boabe, pentru fiecare știindu-se greutatea și prețul. Venind perioada festivalelor, acesta are nevoie de bani. Astfel, s-a gândit că ar trebui să vândă câteva din ele. Acesta va roagă să determinați suma maximă pe care o poate obține, știind că greutățile boabelor vândute trebuie să formeze un subsir strict crescător.
| Problema | BoB | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 50 MB
/
Stivă 5 MB
|
| Id soluție | #61866250 | Utilizator | |
| Fișier | bob.cpp | Dimensiune | 1.07 KB |
| Data încărcării | 12 Decembrie 2025, 18:58 | Scor/rezultat | Eroare de compilare |
bob.cpp: In function 'void update(int, int)': bob.cpp:16:32: error: no matching function for call to 'max(long long int&, int&)' aib[i] = max(aib[i],delta); ^ bob.cpp:16:32: 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/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from bob.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: bob.cpp:16:32: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') aib[i] = max(aib[i],delta); ^ 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/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from bob.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: bob.cpp:16:32: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') aib[i] = max(aib[i],delta); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from bob.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template argument deduction/substitution failed: bob.cpp:16:32: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' aib[i] = max(aib[i],delta); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from bob.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare) max(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template argument deduction/substitution failed: bob.cpp:16:32: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' aib[i] = max(aib[i],delta); ^ bob.cpp: In function 'int query(int)': bob.cpp:26:27: error: no matching function for call to 'max(int&, long long int&)' ans = max(ans,aib[i]); ^ bob.cpp:26:27: 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/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from bob.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: bob.cpp:26:27: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') ans = max(ans,aib[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/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from bob.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: bob.cpp:26:27: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') ans = max(ans,aib[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from bob.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template argument deduction/substitution failed: bob.cpp:26:27: note: mismatched types 'std::initializer_list<_Tp>' and 'int' ans = max(ans,aib[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from bob.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare) max(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template argument deduction/substitution failed: bob.cpp:26:27: note: mismatched types 'std::initializer_list<_Tp>' and 'int' ans = max(ans,aib[i]); ^ bob.cpp: In function 'int main()': bob.cpp:54:5: error: 'll' was not declared in this scope ll ans = 0; ^ bob.cpp:54:8: error: expected ';' before 'ans' ll ans = 0; ^ bob.cpp:61:9: error: 'ans' was not declared in this scope ans = max(ans,dp[i]); ^ bob.cpp:64:11: error: 'ans' was not declared in this scope cout<<ans; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema BoB 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ă.