#4460
BossFight
Gimi a găsit un nou joc, faimos pentru dificultatea sa ridicată. Jocul este alcătuit din N
camere, numerotate de la 1
la N
. Fiecare cameră i
conține un monstru a cărui putere este un număr natural P[i]
. Gimi trece, în ordine, prin toate camerele. În fiecare cameră el poate alege să se lupte cu monstrul sau nu. Gimi se întreabă în câte moduri poate să aleagă 3 monștri cu care să se lupte. Două mulțimi de trei monștri se consideră diferite dacă există cel puțin un monstru în prima mulțime care nu aparține celei de-a doua mulțimi. Formal, se cere numărul de tripleți i < j < k
pentru care P[i] < P[j] < P[k]
și P[i] + P[j] + P[k] ≤ S
.
Lot informatică 2023
Problema | BossFight | Operații I/O |
![]() bossfight.in /bossfight.out
|
---|---|---|---|
Limita timp | 0.8 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #51436496 | Utilizator | |
Fișier | bossfight.cpp | Dimensiune | 758 B |
Data încărcării | 16 Iunie 2024, 21:59 | Scor / rezultat | Eroare de compilare |
bossfight.cpp: In function 'int main()': bossfight.cpp:13:28: error: no matching function for call to 'sort(<unresolved overloaded function type>, <unresolved overloaded function type>)' sort(lhs.begin, lhs.end); ^ bossfight.cpp:13:28: note: candidates are: In file included from /usr/include/c++/4.8/algorithm:62:0, from bossfight.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:5447:5: note: template<class _RAIter> void std::sort(_RAIter, _RAIter) sort(_RandomAccessIterator __first, _RandomAccessIterator __last) ^ /usr/include/c++/4.8/bits/stl_algo.h:5447:5: note: template argument deduction/substitution failed: bossfight.cpp:13:28: note: couldn't deduce template parameter '_RAIter' sort(lhs.begin, lhs.end); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from bossfight.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:5483:5: note: template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare) sort(_RandomAccessIterator __first, _RandomAccessIterator __last, ^ /usr/include/c++/4.8/bits/stl_algo.h:5483:5: note: template argument deduction/substitution failed: bossfight.cpp:13:28: note: candidate expects 3 arguments, 2 provided sort(lhs.begin, lhs.end); ^ bossfight.cpp:16:55: error: no matching function for call to 'lower_bound(<unresolved overloaded function type>, <unresolved overloaded function type>, int&)' lhs.erase(lower_bound(lhs.begin, lhs.end, v[i])); ^ bossfight.cpp:16:55: 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 bossfight.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:943:5: note: template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) lower_bound(_ForwardIterator __first, _ForwardIterator __last, ^ /usr/include/c++/4.8/bits/stl_algobase.h:943:5: note: template argument deduction/substitution failed: bossfight.cpp:16:55: note: couldn't deduce template parameter '_ForwardIterator' lhs.erase(lower_bound(lhs.begin, lhs.end, v[i])); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from bossfight.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:2425:5: note: template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare) lower_bound(_ForwardIterator __first, _ForwardIterator __last, ^ /usr/include/c++/4.8/bits/stl_algo.h:2425:5: note: template argument deduction/substitution failed: bossfight.cpp:16:55: note: candidate expects 4 arguments, 3 provided lhs.erase(lower_bound(lhs.begin, lhs.end, v[i])); ^ bossfight.cpp:17:54: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int x = 0, y = lhs.size(); x < rhs.size(); ++x) { ^ bossfight.cpp:19:32: error: 'ret' was not declared in this scope if (v[i] < rhs[x]) ret += y; ^ bossfight.cpp:21:56: error: no matching function for call to 'lower_bound(<unresolved overloaded function type>, <unresolved overloaded function type>, int&)' rhs.insert(lower_bound(lhs.begin, lhs.end, v[i]), v[i]); ^ bossfight.cpp:21:56: 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 bossfight.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:943:5: note: template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) lower_bound(_ForwardIterator __first, _ForwardIterator __last, ^ /usr/include/c++/4.8/bits/stl_algobase.h:943:5: note: template argument deduction/substitution failed: bossfight.cpp:21:56: note: couldn't deduce template parameter '_ForwardIterator' rhs.insert(lower_bound(lhs.begin, lhs.end, v[i]), v[i]); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from bossfight.cpp:3: /usr/include/c++/4.8/bits/stl_algo.h:2425:5: note: template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare) lower_bound(_ForwardIterator __first, _ForwardIterator __last, ^ /usr/include/c++/4.8/bits/stl_algo.h:2425:5: note: template argument deduction/substitution failed: bossfight.cpp:21:56: note: candidate expects 4 arguments, 3 provided rhs.insert(lower_bound(lhs.begin, lhs.end, v[i]), v[i]); ^ bossfight.cpp:23:10: error: 'ret' was not declared in this scope out<<ret; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema BossFight 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ă.