#1603
Se dă lista muchiilor unui graf neorientat. Pentru fiecare componentă conexă numim cel mai mic vârf de ea reprezentant al componentei conexe. Determinați reprezentantul componentei conexe cu cele mai multe vârfuri și câte noduri conține aceasta.
| Problema | ComponenteConexe3 | Operații I/O |
componenteconexe3.in/componenteconexe3.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #63931406 | Utilizator | |
| Fișier | componenteconexe3.cpp | Dimensiune | 853 B |
| Data încărcării | 27 Martie 2026, 11:45 | Scor/rezultat | Eroare de compilare |
componenteconexe3.cpp: In function 'int main()': componenteconexe3.cpp:40:11: error: reference to 'max' is ambiguous if (n1>max) ^ componenteconexe3.cpp:9:59: note: candidates are: int max int a[101][101],v[101],st,dr,n,x[101],y[101],nr=0,nod,max=0; ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from componenteconexe3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ componenteconexe3.cpp:41:6: error: reference to 'max' is ambiguous { max=n1; ^ componenteconexe3.cpp:9:59: note: candidates are: int max int a[101][101],v[101],st,dr,n,x[101],y[101],nr=0,nod,max=0; ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from componenteconexe3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ componenteconexe3.cpp:42:5: error: 'nmax' was not declared in this scope nmax=nr; ^ componenteconexe3.cpp:48:16: error: reference to 'max' is ambiguous if (v[i]==max ^ componenteconexe3.cpp:9:59: note: candidates are: int max int a[101][101],v[101],st,dr,n,x[101],y[101],nr=0,nod,max=0; ^ In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from componenteconexe3.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ componenteconexe3.cpp:49:10: error: expected ')' before '{' token { g<<nr<<endl; break;} ^ componenteconexe3.cpp: At global scope: componenteconexe3.cpp:51:19: error: expected unqualified-id before 'return' return 0;} ^ componenteconexe3.cpp:51:28: error: expected declaration before '}' token return 0;} ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ComponenteConexe3 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ă.