#636
Arbore
Se dau cele n-1
muchii ale unui arbore cu n
noduri și un nod k
. Afișați vectorul de tați al arborelui cu rădăcina în k
.
Problema | Arbore | Operații I/O |
arbore.in /arbore.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53977021 | Utilizator | |
Fișier | arbore.cpp | Dimensiune | 811 B |
Data încărcării | 16 Noiembrie 2024, 15:00 | Scor / rezultat | Eroare de compilare |
arbore.cpp: In function 'void bfs(int)': arbore.cpp:18:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0;i<a[x].size();i++) ^ arbore.cpp: In function 'int main()': arbore.cpp:32:6: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'std::vector<bool>') v=vector<bool>(n+1,0); ^ arbore.cpp:32:6: note: candidates are: In file included from /usr/include/c++/4.8/vector:69:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from arbore.cpp:1: /usr/include/c++/4.8/bits/vector.tcc:160:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:160:5: note: no known conversion for argument 1 from 'std::vector<bool>' to 'const std::vector<int>&' In file included from /usr/include/c++/4.8/vector:64:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from arbore.cpp:1: /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>] operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) ^ /usr/include/c++/4.8/bits/stl_vector.h:439:7: note: no known conversion for argument 1 from 'std::vector<bool>' to 'std::vector<int>&&' /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>] operator=(initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:461:7: note: no known conversion for argument 1 from 'std::vector<bool>' to 'std::initializer_list<int>'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Arbore 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ă.