#19
BFS
Se consideră un graf neorientat cu n
vârfuri și m
muchii și un vârf cunoscut X
. Să se afişeze vârfurile vizitate în urma parcurgerii în lățime a grafului pornind din vârful X
.
Problema | BFS | Operații I/O |
BFS.in /BFS.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 128 MB
/
Stivă 8 MB
|
Id soluție | #28704472 | Utilizator | |
Fișier | bfs.cpp | Dimensiune | 588 B |
Data încărcării | 15 Martie 2021, 18:06 | Scor / rezultat | Eroare de compilare |
bfs.cpp:8:24: error: storage size of 'coada' isn't known int a[101][101], coada[],vf, ul, viz[101]; ^ bfs.cpp: In function 'void BFS(int)': bfs.cpp:22:1: error: expected ';' before '}' token } ^ bfs.cpp: In function 'int main()': bfs.cpp:26:13: error: 'x' was not declared in this scope in>> n,m , x; ^ bfs.cpp:29:10: error: cannot bind 'std::basic_istream<char>' lvalue to 'std::basic_istream<char>&&' in>>a>>b; ^ In file included from /usr/include/c++/4.8/iostream:40:0, from bfs.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = int [101][101]]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ bfs.cpp:29:13: error: 'b' was not declared in this scope in>>a>>b; ^ bfs.cpp:30:6: error: 'v' was not declared in this scope v[a][b]=1; ^ bfs.cpp:37:5: error: 'i' was not declared in this scope for(i=1;i<=k;i++) ^ bfs.cpp:39:1: error: expected ';' before '}' token } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema BFS 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ă.