#2959
Tommy a descoperit bine-cunoscutul joc Minecraft, joc care este axat pe creativitate și construcție, permițând jucătorilor să construiască, folosind o multitudine de cuburi texturate, o lume tridimensională. Harta lumii lui Tommy este o suprafață pătrată, pe care sunt desenate pătrate egale, alăturate, ce pot fi albastre sau verzi. Fiecare pătrat albastru corespunde unui cub albastru și fiecare pătrat verde corespunde unui cub verde. Sursele de apă sunt reprezentate de pătrate de culoare albastră. Fiecare pătrat verde are atașat un cost, reprezentat de lungimea celui mai scurt drum până la o sursă de apă. Două pătrate alăturate aparțin aceluiași drum dacă au o latură comună. Drumul ajunge la o sursă de apă, dacă, ultimul pătrat de pe drum are o latură comună cu pătratul corespunzător sursei de apă. Lungimea drumului este reprezentată de numărul de pătrate care formează drumul. Costul unei suprafețe este reprezentat de suma costurilor pătratelor care formează suprafața.
Cunoscând harta ce corespunde lumii lui Tommy, să se determine:
Prosoft@NT Piatra Neamț 2019
| Problema | minecraft | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.3 secunde | Limita memorie |
Total: 32 MB
/
Stivă 32 MB
|
| Id soluție | #65019007 | Utilizator | |
| Fișier | minecraft.cpp | Dimensiune | 9.33 KB |
| Data încărcării | 16 Iulie 2026, 11:26 | Scor/rezultat | Eroare de compilare |
minecraft.cpp: In function ‘void task1_2()’: minecraft.cpp:242:18: error: declaration of ‘operator<=’ as non-function 242 | auto operator<=>(const _cell& other) const = default; | ^~~~~~~~ minecraft.cpp:242:26: error: expected ‘;’ at end of member declaration 242 | auto operator<=>(const _cell& other) const = default; | ^~ | ; minecraft.cpp:242:28: error: expected unqualified-id before ‘>’ token 242 | auto operator<=>(const _cell& other) const = default; | ^ In file included from /usr/include/c++/13/string:49, 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/ostream:40, from /usr/include/c++/13/iostream:41, from minecraft.cpp:4: /usr/include/c++/13/bits/stl_function.h: In instantiation of ‘bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = task1_2()::_cell]’: /usr/include/c++/13/bits/stl_tree.h:2118:35: required from ‘std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = task1_2()::_cell; _Val = task1_2()::_cell; _KeyOfValue = std::_Identity<task1_2()::_cell>; _Compare = std::less<task1_2()::_cell>; _Alloc = std::allocator<task1_2()::_cell>; key_type = task1_2()::_cell]’ /usr/include/c++/13/bits/stl_tree.h:2171:4: required from ‘std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = task1_2()::_cell; _Key = task1_2()::_cell; _Val = task1_2()::_cell; _KeyOfValue = std::_Identity<task1_2()::_cell>; _Compare = std::less<task1_2()::_cell>; _Alloc = std::allocator<task1_2()::_cell>]’ /usr/include/c++/13/bits/stl_set.h:523:25: required from ‘std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(value_type&&) [with _Key = task1_2()::_cell; _Compare = std::less<task1_2()::_cell>; _Alloc = std::allocator<task1_2()::_cell>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<task1_2()::_cell, task1_2()::_cell, std::_Identity<task1_2()::_cell>, std::less<task1_2()::_cell>, std::allocator<task1_2()::_cell> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<task1_2()::_cell>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<task1_2()::_cell>, task1_2()::_cell>::rebind<task1_2()::_cell>; typename _Alloc::value_type = task1_2()::_cell; value_type = task1_2()::_cell]’ minecraft.cpp:245:17: required from here /usr/include/c++/13/bits/stl_function.h:408:20: error: no match for ‘operator<’ (operand types are ‘const task1_2()::_cell’ and ‘const task1_2()::_cell’) 408 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/13/bits/stl_algobase.h:64, from /usr/include/c++/13/algorithm:60, from minecraft.cpp:1: /usr/include/c++/13/bits/stl_pair.h:835:5: note: candidate: ‘template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)’ 835 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/13/bits/stl_pair.h:835:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/stl_function.h:408:20: note: ‘const task1_2()::_cell’ is not derived from ‘const std::pair<_T1, _T2>’ 408 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/13/bits/stl_algobase.h:67: /usr/include/c++/13/bits/stl_iterator.h:455:5: note: candidate: ‘template<class _Iterator> bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)’ 455 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/stl_function.h:408:20: note: ‘const task1_2()::_cell’ is not derived from ‘const std::reverse_iterator<_Iterator>’ 408 | { return __x < __y; } | ~~~~^~~~~ /usr/include/c++/13/bits/stl_iterator.h:500:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)’ 500 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/stl_function.h:408:20: note: ‘const task1_2()::_cell’ is not derived from ‘const std::reverse_iterator<_Iterator>’ 408 | { return __x < __y; } | ~~~~^~~~~ /usr/include/c++/13/bits/stl_iterator.h:1705:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)’ 1705 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:1705:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/stl_function.h:408:20: note: ‘const task1_2()::_cell’ is not derived from ‘const std::move_iterator<_IteratorL>’ 408 | { return __x < __y; } | ~~~~^~~~~ /usr/include/c++/13/bits/stl_iterator.h:1770:5: note: candidate: ‘template<class _Iterator> bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)’ 1770 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:1770:5: note: template argument deduction/substitution failed: /usr/include/c++/13/bits/stl_function.h:408:20: note: ‘const task1_2()::_cell’ is not derived from ‘const std::move_iterator<_IteratorL>’ 408 | { return __x < __y; } | ~~~~^~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema minecraft 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ă.