#759
Se consideră un arbore binar în care nodurile memorează numere naturale nenule. Să se afișeze valorile din arbore în urma parcurgerii în lățime, pornind din rădăcină.
Programul citește lista valorilor din arbore, dată în ordinea parcurgerii în preordine.
| Problema | BiLatime | Operații I/O |
bilatime.in/bilatime.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64721067 | Utilizator | |
| Fișier | bilatime.cpp | Dimensiune | 621 B |
| Data încărcării | 26 Mai 2026, 08:22 | Scor/rezultat | Eroare de compilare |
bilatime.cpp: In function ‘void DFS()’: bilatime.cpp:14:23: error: cannot convert ‘__gnu_cxx::__alloc_traits<std::allocator<nod>, nod>::value_type’ {aka ‘nod’} to ‘nod*’ in initialization 14 | nod *p=Q.front(); | ~~~~~~~^~ | | | __gnu_cxx::__alloc_traits<std::allocator<nod>, nod>::value_type {aka nod} bilatime.cpp:17:23: error: no matching function for call to ‘std::queue<nod, std::vector<nod> >::push(nod*&)’ 17 | Q.push(p->st); | ~~~~~~^~~~~~~ In file included from /usr/include/c++/13/queue:66, from bilatime.cpp:3: /usr/include/c++/13/bits/stl_queue.h:285:7: note: candidate: ‘void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = nod; _Sequence = std::vector<nod>; value_type = nod]’ 285 | push(const value_type& __x) | ^~~~ /usr/include/c++/13/bits/stl_queue.h:285:30: note: no known conversion for argument 1 from ‘nod*’ to ‘const std::queue<nod, std::vector<nod> >::value_type&’ {aka ‘const nod&’} 285 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/13/bits/stl_queue.h:290:7: note: candidate: ‘void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = nod; _Sequence = std::vector<nod>; value_type = nod]’ 290 | push(value_type&& __x) | ^~~~ /usr/include/c++/13/bits/stl_queue.h:290:25: note: no known conversion for argument 1 from ‘nod*’ to ‘std::queue<nod, std::vector<nod> >::value_type&&’ {aka ‘nod&&’} 290 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~ bilatime.cpp:19:23: error: no matching function for call to ‘std::queue<nod, std::vector<nod> >::push(nod*&)’ 19 | Q.push(p->dr); | ~~~~~~^~~~~~~ /usr/include/c++/13/bits/stl_queue.h:285:7: note: candidate: ‘void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = nod; _Sequence = std::vector<nod>; value_type = nod]’ 285 | push(const value_type& __x) | ^~~~ /usr/include/c++/13/bits/stl_queue.h:285:30: note: no known conversion for argument 1 from ‘nod*’ to ‘const std::queue<nod, std::vector<nod> >::value_type&’ {aka ‘const nod&’} 285 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/13/bits/stl_queue.h:290:7: note: candidate: ‘void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = nod; _Sequence = std::vector<nod>; value_type = nod]’ 290 | push(value_type&& __x) | ^~~~ /usr/include/c++/13/bits/stl_queue.h:290:25: note: no known conversion for argument 1 from ‘nod*’ to ‘std::queue<nod, std::vector<nod> >::value_type&&’ {aka ‘nod&&’} 290 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~ bilatime.cpp: In function ‘int main()’: bilatime.cpp:42:23: error: no matching function for call to ‘std::queue<nod, std::vector<nod> >::push(nod*&)’ 42 | Q.push(head); | ~~~~~~^~~~~~ /usr/include/c++/13/bits/stl_queue.h:285:7: note: candidate: ‘void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = nod; _Sequence = std::vector<nod>; value_type = nod]’ 285 | push(const value_type& __x) | ^~~~ /usr/include/c++/13/bits/stl_queue.h:285:30: note: no known conversion for argument 1 from ‘nod*’ to ‘const std::queue<nod, std::vector<nod> >::value_type&’ {aka ‘const nod&’} 285 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/13/bits/stl_queue.h:290:7: note: candidate: ‘void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = nod; _Sequence = std::vector<nod>; value_type = nod]’ 290 | push(value_type&& __x) | ^~~~ /usr/include/c++/13/bits/stl_queue.h:290:25: note: no known conversion for argument 1 from ‘nod*’ to ‘std::queue<nod, std::vector<nod> >::value_type&&’ {aka ‘nod&&’} 290 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~ /usr/include/c++/13/bits/stl_queue.h: In instantiation of ‘void std::queue<_Tp, _Sequence>::pop() [with _Tp = nod; _Sequence = std::vector<nod>]’: bilatime.cpp:15:7: required from here /usr/include/c++/13/bits/stl_queue.h:321:11: error: ‘class std::vector<nod>’ has no member named ‘pop_front’ 321 | c.pop_front(); | ~~^~~~~~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema BiLatime 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ă.