#2282
Se consideră un graf neorientat cu n vârfuri și m muchii. Cele m muchii se elimină pe rând din graf. Pentru fiecare muchie eliminată trebuie să spuneți câte componente conexe are graful.
| Problema | ComponenteConexe4 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64656776 | Utilizator | |
| Fișier | componenteconexe4.cpp | Dimensiune | 1.18 KB |
| Data încărcării | 20 Mai 2026, 21:18 | Scor/rezultat | Eroare de compilare |
componenteconexe4.cpp: In function ‘void Solve()’: componenteconexe4.cpp:61:26: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 61 | for (const auto& [a, b] : edges) | ^ In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/c++allocator.h:33, from /usr/include/c++/13/bits/allocator.h:46, from /usr/include/c++/13/string:43, 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 componenteconexe4.cpp:1: /usr/include/c++/13/bits/new_allocator.h: In instantiation of ‘void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = Edge; _Args = {int&, int&}; _Tp = Edge]’: /usr/include/c++/13/bits/alloc_traits.h:538:17: required from ‘static void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = Edge; _Args = {int&, int&}; _Tp = Edge; allocator_type = std::allocator<Edge>]’ /usr/include/c++/13/bits/deque.tcc:145:30: required from ‘void std::deque<_Tp, _Alloc>::emplace_front(_Args&& ...) [with _Args = {int&, int&}; _Tp = Edge; _Alloc = std::allocator<Edge>]’ componenteconexe4.cpp:53:22: required from here /usr/include/c++/13/bits/new_allocator.h:191:11: error: new initializer expression list treated as compound expression [-fpermissive] 191 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/new_allocator.h:191:11: error: no matching function for call to ‘Edge::Edge(int&)’ componenteconexe4.cpp:17:8: note: candidate: ‘Edge::Edge()’ 17 | struct Edge { | ^~~~ componenteconexe4.cpp:17:8: note: candidate expects 0 arguments, 1 provided componenteconexe4.cpp:17:8: note: candidate: ‘constexpr Edge::Edge(const Edge&)’ componenteconexe4.cpp:17:8: note: no known conversion for argument 1 from ‘int’ to ‘const Edge&’ componenteconexe4.cpp:17:8: note: candidate: ‘constexpr Edge::Edge(Edge&&)’ componenteconexe4.cpp:17:8: note: no known conversion for argument 1 from ‘int’ to ‘Edge&&’
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ComponenteConexe4 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ă.