#4073
Se dă lista muchiilor unui graf neorientat cu n noduri și m muchii și un șir de q noduri. Să se determine pentru fiecare nod x din șir numărul de noduri din componenta conexă din care face parte x.
| Problema | ComponenteConexe5 | Operații I/O |
componenteconexe5.in/componenteconexe5.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #63582034 | Utilizator | |
| Fișier | componenteconexe5.cpp | Dimensiune | 2.81 KB |
| Data încărcării | 10 Martie 2026, 12:21 | Scor/rezultat | Eroare de compilare |
componenteconexe5.cpp:53:1: warning: "/*" within comment [-Wcomment] /* ^ componenteconexe5.cpp:61:17: error: redefinition of 'int a [1001][1001]' int a[1001][1001], coada[1001], p[1010], p2[1010], paths[1001][1001]; ^ componenteconexe5.cpp:7:5: error: 'int a [1001][1001]' previously declared here int a[1001][1001], n, m, q, x[1001], p[1001], nod[1001]; ^ componenteconexe5.cpp:61:39: error: conflicting declaration 'int p [1010]' int a[1001][1001], coada[1001], p[1010], p2[1010], paths[1001][1001]; ^ componenteconexe5.cpp:7:38: error: 'p' has a previous declaration as 'int p [1001]' int a[1001][1001], n, m, q, x[1001], p[1001], nod[1001]; ^ componenteconexe5.cpp:62:5: error: redefinition of 'int n' int n, m, x, y, kol, miau=1, ham=-1001, inox; ^ componenteconexe5.cpp:7:20: error: 'int n' previously declared here int a[1001][1001], n, m, q, x[1001], p[1001], nod[1001]; ^ componenteconexe5.cpp:62:8: error: redefinition of 'int m' int n, m, x, y, kol, miau=1, ham=-1001, inox; ^ componenteconexe5.cpp:7:23: error: 'int m' previously declared here int a[1001][1001], n, m, q, x[1001], p[1001], nod[1001]; ^ componenteconexe5.cpp:62:11: error: conflicting declaration 'int x' int n, m, x, y, kol, miau=1, ham=-1001, inox; ^ componenteconexe5.cpp:7:29: error: 'x' has a previous declaration as 'int x [1001]' int a[1001][1001], n, m, q, x[1001], p[1001], nod[1001]; ^ componenteconexe5.cpp: In function 'void bfs_paths(int, int)': componenteconexe5.cpp:92:27: warning: statement has no effect [-Wunused-value] paths[s][i]; ^ componenteconexe5.cpp: In function 'int main()': componenteconexe5.cpp:101:5: error: redefinition of 'int main()' int main() ^ componenteconexe5.cpp:29:5: error: 'int main()' previously defined here int main() ^ componenteconexe5.cpp:106:14: error: cannot bind 'std::istream {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&' cin>>x>>y; ^ In file included from /usr/include/c++/4.8/sstream:38:0, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from componenteconexe5.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 [1001]]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ componenteconexe5.cpp:107:12: error: invalid types 'int [1001][1001][int [1001]]' for array subscript a[x][y]=a[y][x]=1; ^ componenteconexe5.cpp:107:23: error: invalid types 'int [1001][int [1001]]' for array subscript a[x][y]=a[y][x]=1; ^ componenteconexe5.cpp:110:10: error: cannot bind 'std::istream {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&' cin>>x>>y; ^ In file included from /usr/include/c++/4.8/sstream:38:0, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from componenteconexe5.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 [1001]]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ componenteconexe5.cpp:125:11: error: invalid types 'int [1001][int [1001]]' for array subscript if(p[x]==p[y]) ^ componenteconexe5.cpp:127:23: error: invalid conversion from 'int*' to 'int' [-fpermissive] bfs_paths(x, y); ^ componenteconexe5.cpp:80:6: error: initializing argument 1 of 'void bfs_paths(int, int)' [-fpermissive] void bfs_paths(int x, int y) ^ componenteconexe5.cpp: At global scope: componenteconexe5.cpp:145:2: error: expected unqualified-id before '/' token */ ^ componenteconexe5.cpp:145:2: error: expected constructor, destructor, or type conversion before '/' token
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ComponenteConexe5 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ă.