#3624
Tocmai a ajuns la balul din sat un grup de n fete numerotate de la 1 la n. Acolo sunt așteptate de m băieți frumoși, numerotați de la 1 la m. Fiecare băiat i (i=1..m) are un coeficient de frumusețe b[i]. Fetele nu acceptă orice băiat la dans. Fata i va accepta să danseze cu un băiat doar dacă băiatul are un coeficient de frumusețe mai mare sau egal cu f[i]. Cunoscând coeficienții de frumusețe ai băieților, b[1], b[2], …, b[m] precum și coeficienții preferințelor fetelor, f[1], f[2], …, f[n], să se determine numărul maxim de perechi de dansatori care se poate forma.
Folclorul informatic
| Problema | bal1 | Operații I/O |
bal.in/bal.out
|
|---|---|---|---|
| Limita timp | 0.3 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64258548 | Utilizator | |
| Fișier | bal1.cpp | Dimensiune | 586 B |
| Data încărcării | 26 Aprilie 2026, 19:38 | Scor/rezultat | Eroare de compilare |
bal1.cpp:9:5: error: conflicting declaration ‘int f [100001]’ 9 | int f[100001], b[100001]; | ^ bal1.cpp:6:8: note: previous declaration as ‘std::string f’ 6 | string f = "bal"; | ^ bal1.cpp: In function ‘int main()’: bal1.cpp:17:10: error: no match for ‘operator+’ (operand types are ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} and ‘int’) 17 | sort(f + 1, f + n + 1); | ~ ^ ~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/13/string:48, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/istream:40, from /usr/include/c++/13/fstream:40, from bal1.cpp:1: /usr/include/c++/13/bits/stl_iterator.h:634:5: note: candidate: ‘template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)’ 634 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:634:5: note: template argument deduction/substitution failed: bal1.cpp:17:12: note: mismatched types ‘const std::reverse_iterator<_Iterator>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/stl_iterator.h:1808:5: note: candidate: ‘template<class _Iterator> std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)’ 1808 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:1808:5: note: template argument deduction/substitution failed: bal1.cpp:17:12: note: mismatched types ‘const std::move_iterator<_IteratorL>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ In file included from /usr/include/c++/13/string:54: /usr/include/c++/13/bits/basic_string.h:3553:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3553 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3553:5: note: template argument deduction/substitution failed: bal1.cpp:17:12: note: mismatched types ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3571:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3571 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3571:5: note: template argument deduction/substitution failed: bal1.cpp:17:12: note: mismatched types ‘const _CharT*’ and ‘std::__cxx11::basic_string<char>’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3590:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3590 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3590:5: note: template argument deduction/substitution failed: bal1.cpp:17:12: note: mismatched types ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3607:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)’ 3607 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3607:5: note: template argument deduction/substitution failed: bal1.cpp:17:12: note: mismatched types ‘const _CharT*’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3625:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT)’ 3625 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3625:5: note: template argument deduction/substitution failed: bal1.cpp:17:12: note: deduced conflicting types for parameter ‘_CharT’ (‘char’ and ‘int’) 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3637:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3637 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3637:5: note: template argument deduction/substitution failed: bal1.cpp:17:12: note: mismatched types ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3644:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’ 3644 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3644:5: note: template argument deduction/substitution failed: bal1.cpp:17:12: note: mismatched types ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3651:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’ 3651 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3651:5: note: template argument deduction/substitution failed: bal1.cpp:17:12: note: mismatched types ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3674:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’ 3674 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3674:5: note: template argument deduction/substitution failed: bal1.cpp:17:12: note: mismatched types ‘const _CharT*’ and ‘std::__cxx11::basic_string<char>’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3681:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’ 3681 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3681:5: note: template argument deduction/substitution failed: bal1.cpp:17:12: note: mismatched types ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3688:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _CharT*)’ 3688 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3688:5: note: template argument deduction/substitution failed: bal1.cpp:17:12: note: mismatched types ‘const _CharT*’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3695:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, _CharT)’ 3695 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3695:5: note: template argument deduction/substitution failed: bal1.cpp:17:12: note: deduced conflicting types for parameter ‘_CharT’ (‘char’ and ‘int’) 17 | sort(f + 1, f + n + 1); | ^ bal1.cpp:17:17: error: no match for ‘operator+’ (operand types are ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} and ‘int’) 17 | sort(f + 1, f + n + 1); | ~ ^ ~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} /usr/include/c++/13/bits/stl_iterator.h:634:5: note: candidate: ‘template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)’ 634 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:634:5: note: template argument deduction/substitution failed: bal1.cpp:17:19: note: mismatched types ‘const std::reverse_iterator<_Iterator>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/stl_iterator.h:1808:5: note: candidate: ‘template<class _Iterator> std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)’ 1808 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:1808:5: note: template argument deduction/substitution failed: bal1.cpp:17:19: note: mismatched types ‘const std::move_iterator<_IteratorL>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3553:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3553 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3553:5: note: template argument deduction/substitution failed: bal1.cpp:17:19: note: mismatched types ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3571:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3571 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3571:5: note: template argument deduction/substitution failed: bal1.cpp:17:19: note: mismatched types ‘const _CharT*’ and ‘std::__cxx11::basic_string<char>’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3590:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3590 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3590:5: note: template argument deduction/substitution failed: bal1.cpp:17:19: note: mismatched types ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3607:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)’ 3607 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3607:5: note: template argument deduction/substitution failed: bal1.cpp:17:19: note: mismatched types ‘const _CharT*’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3625:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT)’ 3625 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3625:5: note: template argument deduction/substitution failed: bal1.cpp:17:19: note: deduced conflicting types for parameter ‘_CharT’ (‘char’ and ‘int’) 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3637:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3637 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3637:5: note: template argument deduction/substitution failed: bal1.cpp:17:19: note: mismatched types ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3644:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’ 3644 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3644:5: note: template argument deduction/substitution failed: bal1.cpp:17:19: note: mismatched types ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3651:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’ 3651 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3651:5: note: template argument deduction/substitution failed: bal1.cpp:17:19: note: mismatched types ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3674:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’ 3674 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3674:5: note: template argument deduction/substitution failed: bal1.cpp:17:19: note: mismatched types ‘const _CharT*’ and ‘std::__cxx11::basic_string<char>’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3681:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’ 3681 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3681:5: note: template argument deduction/substitution failed: bal1.cpp:17:19: note: mismatched types ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3688:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _CharT*)’ 3688 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3688:5: note: template argument deduction/substitution failed: bal1.cpp:17:19: note: mismatched types ‘const _CharT*’ and ‘int’ 17 | sort(f + 1, f + n + 1); | ^ /usr/include/c++/13/bits/basic_string.h:3695:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, _CharT)’ 3695 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3695:5: note: template argument deduction/substitution failed: bal1.cpp:17:19: note: deduced conflicting types for parameter ‘_CharT’ (‘char’ and ‘int’) 17 | sort(f + 1, f + n + 1); | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema bal1 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ă.