#1134
Panda
O rezervație de urși panda, privită de sus, are formă dreptunghiulară și este compusă din n
rânduri identice, iar pe fiecare rând sunt m
țarcuri identice cu baza pătrată. Țarcurile sunt îngrădite și sunt prevăzute cu uși către toate cele 4
țarcuri vecine. Ușile sunt prevăzute cu câte un cod de acces, ca atare acestea se închid și se deschid automat. Prin acest sistem, unele ţarcuri sunt accesibile ursuleților, iar altele le sunt interzise acestora. În T
țarcuri se găsește mâncare pentru ursuleți.
Ursuleții din rezervație poartă câte un microcip care le deschide automat ușile țarcurilor unde pot intra și închide automat uşile țarcurilor interzise. Un țarc este accesibil ursulețului dacă ultimele S
cifre ale reprezentărilor binare ale codului țarcului și ale codului k
de pe microcip sunt complementare. (Exemplu: pentru S=8
, 11101011
și 00010100
sunt complementare).
Într-un țarc este un ursuleț căruia i s-a făcut foame. Ursulețul se deplasează doar paralel cu laturile dreptunghiului. Trecerea dintr-un țarc în altul vecin cu el se face într-o secundă.
Cunoscând n
și m
dimensiunile rezervației, codurile de acces de la fiecare dintre cele n*m
țarcuri, coordonatele celor T
țarcuri cu mâncare, coordonatele țarcului L
și C
unde se află inițial ursulețul, codul k
al microcipului său și numărul S
, determinați:
a) Numărul X
de țarcuri care îndeplinesc proprietatea că ultimele S
cifre din reprezentarea binară a codului lor sunt complementare cu ultimele S
cifre din reprezentarea binară a codului k
purtat de ursuleț, cu excepția țarcului în care se află acesta inițial.
b) Numărul minim de secunde Smin
în care poate ajunge la un țarc cu mâncare precum și numărul de țarcuri cu mâncare nt
la care poate ajunge în acest timp minim.
Problema | Panda | Operații I/O |
![]() panda.in /panda.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 8 MB
/
Stivă 2 MB
|
Id soluție | #49536913 | Utilizator | |
Fișier | panda.cpp | Dimensiune | 3.09 KB |
Data încărcării | 06 Martie 2024, 11:41 | Scor / rezultat | Eroare de compilare |
panda.cpp: In member function 'Vec2 Vec2::operator+=(Vec2)': panda.cpp:35:2: warning: no return statement in function returning non-void [-Wreturn-type] } ^ panda.cpp: In function 'std::ostream& operator<<(std::ostream&, Vec2)': panda.cpp:46:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ panda.cpp: In function 'int main()': panda.cpp:171:25: warning: left shift count >= width of type [enabled by default] out < res.dist - 1 << ' ' << res.ct; ^ panda.cpp:171:18: warning: suggest parentheses around '-' inside '<<' [-Wparentheses] out < res.dist - 1 << ' ' << res.ct; ^ panda.cpp:171:7: error: no match for 'operator<' (operand types are 'std::ofstream {aka std::basic_ofstream<char>}' and 'int') out < res.dist - 1 << ' ' << res.ct; ^ panda.cpp:171:7: note: candidates are: In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from panda.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:220:5: note: template<class _T1, class _T2> constexpr bool std::operator<(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) ^ /usr/include/c++/4.8/bits/stl_pair.h:220:5: note: template argument deduction/substitution failed: panda.cpp:171:36: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::pair<_T1, _T2>' out < res.dist - 1 << ' ' << res.ct; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from panda.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:297:5: note: template<class _Iterator> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&) operator<(const reverse_iterator<_Iterator>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:297:5: note: template argument deduction/substitution failed: panda.cpp:171:36: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::reverse_iterator<_Iterator>' out < res.dist - 1 << ' ' << res.ct; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from panda.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:347:5: note: template<class _IteratorL, class _IteratorR> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&) operator<(const reverse_iterator<_IteratorL>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:347:5: note: template argument deduction/substitution failed: panda.cpp:171:36: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::reverse_iterator<_Iterator>' out < res.dist - 1 << ' ' << res.ct; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from panda.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1055:5: note: template<class _IteratorL, class _IteratorR> bool std::operator<(const std::move_iterator<_Iterator>&, const std::move_iterator<_IteratorR>&) operator<(const move_iterator<_IteratorL>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:1055:5: note: template argument deduction/substitution failed: panda.cpp:171:36: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::move_iterator<_Iterator>' out < res.dist - 1 << ' ' << res.ct; ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from panda.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1061:5: note: template<class _Iterator> bool std::operator<(const std::move_iterator<_Iterator>&, const std::move_iterator<_Iterator>&) operator<(const move_iterator<_Iterator>& __x, ^ /usr/include/c++/4.8/bits/stl_iterator.h:1061:5: note: template argument deduction/substitution failed: panda.cpp:171:36: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::move_iterator<_Iterator>' out < res.dist - 1 << ' ' << res.ct; ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from panda.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2569:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&) operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2569:5: note: template argument deduction/substitution failed: panda.cpp:171:36: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::basic_string<_CharT, _Traits, _Alloc>' out < res.dist - 1 << ' ' << res.ct; ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from panda.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2581:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*) operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2581:5: note: template argument deduction/substitution failed: panda.cpp:171:36: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::basic_string<_CharT, _Traits, _Alloc>' out < res.dist - 1 << ' ' << res.ct; ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from panda.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2593:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&) operator<(const _CharT* __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2593:5: note: template argument deduction/substitution failed: panda.cpp:171:36: note: mismatched types 'const _CharT*' and 'std::basic_ofstream<char>' out < res.dist - 1 << ' ' << res.ct; ^ In file included from /usr/include/c++/4.8/deque:64:0, from /usr/include/c++/4.8/queue:60, from panda.cpp:3: /usr/include/c++/4.8/bits/stl_deque.h:273:5: note: template<class _Tp, class _Ref, class _Ptr> bool std::operator<(const std::_Deque_iterator<_Tp, _Ref, _Ptr>&, const std::_Deque_iterator<_Tp, _Ref, _Ptr>&) operator<(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, ^ /usr/include/c++/4.8/bits/stl_deque.h:273:5: note: template argument deduction/substitution failed: panda.cpp:171:36: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::_Deque_iterator<_Tp, _Ref, _Ptr>' out < res.dist - 1 << ' ' << res.ct; ^ In file included from /usr/include/c++/4.8/deque:64:0, from /usr/include/c++/4.8/queue:60, from panda.cpp:3: /usr/include/c++/4.8/bits/stl_deque.h:281:5: note: template<class _Tp, class _RefL, class _PtrL, class _RefR, class _PtrR> bool std::operator<(const std::_Deque_iterator<_Tp, _Ref, _Ptr>&, const std::_Deque_iterator<_Tp, _RefR, _PtrR>&) operator<(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, ^ /usr/include/c++/4.8/bits/stl_deque.h:281:5: note: template argument deduction/substitution failed: panda.cpp:171:36: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::_Deque_iterator<_Tp, _Ref, _Ptr>' out < res.dist - 1 << ' ' << res.ct; ^ In file included from /usr/include/c++/4.8/deque:64:0, from /usr/include/c++/4.8/queue:60, from panda.cpp:3: /usr/include/c++/4.8/bits/stl_deque.h:1975:5: note: template<class _Tp, class _Alloc> bool std::operator<(const std::deque<_Tp, _Alloc>&, const std::deque<_Tp, _Alloc>&) operator<(const deque<_Tp, _Alloc>& __x, ^ /usr/include/c++/4.8/bits/stl_deque.h:1975:5: note: template argument deduction/substitution failed: panda.cpp:171:36: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::deque<_Tp, _Alloc>' out < res.dist - 1 << ' ' << res.ct; ^ In file included from /usr/include/c++/4.8/vector:64:0, from /usr/include/c++/4.8/queue:61, from panda.cpp:3: /usr/include/c++/4.8/bits/stl_vector.h:1421:5: note: template<class _Tp, class _Alloc> bool std::operator<(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&) operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) ^ /usr/include/c++/4.8/bits/stl_vector.h:1421:5: note: template argument deduction/substitution failed: panda.cpp:171:36: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::vector<_Tp, _Alloc>' out < res.dist - 1 << ' ' << res.ct; ^ In file included from /usr/include/c++/4.8/queue:64:0, from panda.cpp:3: /usr/include/c++/4.8/bits/stl_queue.h:286:5: note: template<class _Tp, class _Seq> bool std::operator<(const std::queue<_Tp, _Seq>&, const std::queue<_Tp, _Seq>&) operator<(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) ^ /usr/include/c++/4.8/bits/stl_queue.h:286:5: note: template argument deduction/substitution failed: panda.cpp:171:36: note: 'std::ofstream {aka std::basic_ofstream<char>}' is not derived from 'const std::queue<_Tp, _Seq>' out < res.dist - 1 << ' ' << res.ct; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Panda 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ă.