#1111
Zimeria
Olimpia D’Info a găsit o placă gravată ce conţine mai multe cuvinte scrise cu semne grafice necunoscute, fiecare cuvânt fiind format din exact 5
semne grafice. Studiind cu atenție cuvintele, a dedus că în scrierea acestora sunt utilizate 12
semne grafice distincte şi a asociat câte o literă mică din alfabetul englez fiecărui semn. După asociere, a stabilit pentru fiecare semn o complexitate, scriind literele în ordinea crescătoare a complexităților pe care le-a stabilit anterior. Olimpia consideră că această ”complexitate” este cel mai potrivit criteriu de ordonare lexicografică.
Cunoscând ordinea semnelor și cuvintele de pe placă determinaţi:
a) Numărul de cuvinte distincte existente pe placă.
b) Şirul de cuvinte ordonat lexicografic, conform criteriului formulat de Olimpia.
Problema | Zimeria | Operații I/O |
zimeria.in /zimeria.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 4 MB
/
Stivă 2 MB
|
Id soluție | #53672327 | Utilizator | |
Fișier | zimeria.cpp | Dimensiune | 1.10 KB |
Data încărcării | 07 Noiembrie 2024, 21:24 | Scor / rezultat | Eroare de compilare |
zimeria.cpp: In function 'int main()': zimeria.cpp:30:29: error: no matching function for call to 'std::map<std::basic_string<char>, int>::insert(std::string&)' st.insert(cuv); ^ zimeria.cpp:30:29: note: candidates are: In file included from /usr/include/c++/4.8/map:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:80, from zimeria.cpp:1: /usr/include/c++/4.8/bits/stl_map.h:594:7: note: std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const value_type&) [with _Key = std::basic_string<char>; _Tp = int; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::pair<const _Key, _Tp> >::other>::iterator = std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const std::basic_string<char>, int>] insert(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_map.h:594:7: note: no known conversion for argument 1 from 'std::string {aka std::basic_string<char>}' to 'const value_type& {aka const std::pair<const std::basic_string<char>, int>&}' /usr/include/c++/4.8/bits/stl_map.h:602:9: note: template<class _Pair, class> std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(_Pair&&) [with _Pair = _Pair; <template-parameter-2-2> = <template-parameter-1-2>; _Key = std::basic_string<char>; _Tp = int; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >] insert(_Pair&& __x) ^ /usr/include/c++/4.8/bits/stl_map.h:602:9: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/stl_map.h:598:32: error: no type named 'type' in 'struct std::enable_if<false, void>' template<typename _Pair, typename = typename ^ /usr/include/c++/4.8/bits/stl_map.h:615:7: note: void std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::initializer_list<std::pair<const _Key, _Tp> >) [with _Key = std::basic_string<char>; _Tp = int; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >] insert(std::initializer_list<value_type> __list) ^ /usr/include/c++/4.8/bits/stl_map.h:615:7: note: no known conversion for argument 1 from 'std::string {aka std::basic_string<char>}' to 'std::initializer_list<std::pair<const std::basic_string<char>, int> >' /usr/include/c++/4.8/bits/stl_map.h:644:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, const value_type&) [with _Key = std::basic_string<char>; _Tp = int; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const std::basic_string<char>, int>] insert(const_iterator __position, const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_map.h:644:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/4.8/bits/stl_map.h:655:9: note: template<class _Pair, class> std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, _Pair&&) [with _Pair = _Pair; <template-parameter-2-2> = <template-parameter-1-2>; _Key = std::basic_string<char>; _Tp = int; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >] insert(const_iterator __position, _Pair&& __x) ^ /usr/include/c++/4.8/bits/stl_map.h:655:9: note: template argument deduction/substitution failed: zimeria.cpp:30:29: note: cannot convert 'cuv' (type 'std::string {aka std::basic_string<char>}') to type 'std::map<std::basic_string<char>, int>::const_iterator {aka std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char>, int> >}' st.insert(cuv); ^ In file included from /usr/include/c++/4.8/map:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:80, from zimeria.cpp:1: /usr/include/c++/4.8/bits/stl_map.h:670:9: note: template<class _InputIterator> void std::map<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = std::basic_string<char>; _Tp = int; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >] insert(_InputIterator __first, _InputIterator __last) ^ /usr/include/c++/4.8/bits/stl_map.h:670:9: note: template argument deduction/substitution failed: zimeria.cpp:30:29: note: candidate expects 2 arguments, 1 provided st.insert(cuv); ^ zimeria.cpp:50:26: error: no matching function for call to 'std::map<std::basic_string<char>, int>::insert(std::string&)' st.insert(cuv); ^ zimeria.cpp:50:26: note: candidates are: In file included from /usr/include/c++/4.8/map:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:80, from zimeria.cpp:1: /usr/include/c++/4.8/bits/stl_map.h:594:7: note: std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const value_type&) [with _Key = std::basic_string<char>; _Tp = int; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::pair<const _Key, _Tp> >::other>::iterator = std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const std::basic_string<char>, int>] insert(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_map.h:594:7: note: no known conversion for argument 1 from 'std::string {aka std::basic_string<char>}' to 'const value_type& {aka const std::pair<const std::basic_string<char>, int>&}' /usr/include/c++/4.8/bits/stl_map.h:602:9: note: template<class _Pair, class> std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(_Pair&&) [with _Pair = _Pair; <template-parameter-2-2> = <template-parameter-1-2>; _Key = std::basic_string<char>; _Tp = int; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >] insert(_Pair&& __x) ^ /usr/include/c++/4.8/bits/stl_map.h:602:9: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/stl_map.h:598:32: error: no type named 'type' in 'struct std::enable_if<false, void>' template<typename _Pair, typename = typename ^ /usr/include/c++/4.8/bits/stl_map.h:615:7: note: void std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::initializer_list<std::pair<const _Key, _Tp> >) [with _Key = std::basic_string<char>; _Tp = int; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >] insert(std::initializer_list<value_type> __list) ^ /usr/include/c++/4.8/bits/stl_map.h:615:7: note: no known conversion for argument 1 from 'std::string {aka std::basic_string<char>}' to 'std::initializer_list<std::pair<const std::basic_string<char>, int> >' /usr/include/c++/4.8/bits/stl_map.h:644:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, const value_type&) [with _Key = std::basic_string<char>; _Tp = int; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char>, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::value_type = std::pair<const std::basic_string<char>, int>] insert(const_iterator __position, const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_map.h:644:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/4.8/bits/stl_map.h:655:9: note: template<class _Pair, class> std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, _Pair&&) [with _Pair = _Pair; <template-parameter-2-2> = <template-parameter-1-2>; _Key = std::basic_string<char>; _Tp = int; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >] insert(const_iterator __position, _Pair&& __x) ^ /usr/include/c++/4.8/bits/stl_map.h:655:9: note: template argument deduction/substitution failed: zimeria.cpp:50:26: note: cannot convert 'cuv' (type 'std::string {aka std::basic_string<char>}') to type 'std::map<std::basic_string<char>, int>::const_iterator {aka std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char>, int> >}' st.insert(cuv); ^ In file included from /usr/include/c++/4.8/map:61:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:80, from zimeria.cpp:1: /usr/include/c++/4.8/bits/stl_map.h:670:9: note: template<class _InputIterator> void std::map<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = std::basic_string<char>; _Tp = int; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, int> >] insert(_InputIterator __first, _InputIterator __last) ^ /usr/include/c++/4.8/bits/stl_map.h:670:9: note: template argument deduction/substitution failed: zimeria.cpp:50:26: note: candidate expects 2 arguments, 1 provided st.insert(cuv); ^ zimeria.cpp:53:22: error: conversion from 'std::pair<const std::basic_string<char>, int>' to non-scalar type 'std::string {aka std::basic_string<char>}' requested for(string s:st) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Zimeria 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ă.