#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 | #52923346 | Utilizator | |
Fișier | bfs.cpp | Dimensiune | 526 B |
Data încărcării | 13 Octombrie 2024, 10:22 | Scor / rezultat | Eroare de compilare |
bfs.cpp:4:26: warning: missing terminating ' character [enabled by default] ofstream cout ("bfs.out")' ^ bfs.cpp:4:1: error: missing terminating ' character ofstream cout ("bfs.out")' ^ bfs.cpp:5:1: error: expected ',' or ';' before 'int' int i,k,st,dr,j,n,m,X,a[101][101],P[101],V[101]; ^ bfs.cpp: In function 'int main()': bfs.cpp:8:12: error: 'n' was not declared in this scope cin >> n >> m >> X; ^ bfs.cpp:8:17: error: 'm' was not declared in this scope cin >> n >> m >> X; ^ bfs.cpp:8:22: error: 'X' was not declared in this scope cin >> n >> m >> X; ^ bfs.cpp:9:20: error: 'i' was not declared in this scope while ( cin >> i >> j ) ^ bfs.cpp:9:25: error: 'j' was not declared in this scope while ( cin >> i >> j ) ^ bfs.cpp:10:9: error: 'a' was not declared in this scope a[i][j] = a[j][i] = 1; ^ bfs.cpp:11:5: error: 'st' was not declared in this scope st = dr = 1; ^ bfs.cpp:11:10: error: 'dr' was not declared in this scope st = dr = 1; ^ bfs.cpp:12:5: error: 'P' was not declared in this scope P[1] = X; ^ bfs.cpp:13:5: error: 'V' was not declared in this scope V[X] = 1; ^ bfs.cpp:16:9: error: 'k' was not declared in this scope k = P[st]; ^ bfs.cpp:18:15: error: 'i' was not declared in this scope for ( i = 1; i <= n; i++ ) ^ bfs.cpp:19:32: error: 'a' was not declared in this scope if ( V[i] == 0 and a[k][i] == 1 ) ^
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ă.