Detalii evaluare #36000002

Rezumat problemă

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.

Detalii

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 #36000002 Utilizator Dinu Andrei (anduad19)
Fișier componenteconexe3.cpp Dimensiune 752 B
Data încărcării 31 Martie 2022, 07:23 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

componenteconexe3.cpp:6:50: error: conflicting declaration 'int f [101]'
 int n , x , y , C[101] , cnt , maxi , rez , f[101];

                                                  ^
componenteconexe3.cpp:4:10: error: 'f' has a previous declaration as 'std::ifstream f'
 ifstream f("componenteconexe3.in");

          ^
componenteconexe3.cpp: In function 'void dfs(int, int)':
componenteconexe3.cpp:14:20: error: no matching function for call to 'begin(int&)'
     for(int i : G[v])

                    ^
componenteconexe3.cpp:14:20: note: candidates are:
In file included from /usr/include/c++/4.8/bits/basic_string.h:42:0,
                 from /usr/include/c++/4.8/string:52,
                 from /usr/include/c++/4.8/bits/locale_classes.h:40,
                 from /usr/include/c++/4.8/bits/ios_base.h:41,
                 from /usr/include/c++/4.8/ios:42,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from componenteconexe3.cpp:1:
/usr/include/c++/4.8/initializer_list:89:5: note: template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>)
     begin(initializer_list<_Tp> __ils) noexcept
     ^
/usr/include/c++/4.8/initializer_list:89:5: note:   template argument deduction/substitution failed:
componenteconexe3.cpp:14:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
     for(int i : G[v])

                    ^
In file included from /usr/include/c++/4.8/string:51:0,
                 from /usr/include/c++/4.8/bits/locale_classes.h:40,
                 from /usr/include/c++/4.8/bits/ios_base.h:41,
                 from /usr/include/c++/4.8/ios:42,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from componenteconexe3.cpp:1:
/usr/include/c++/4.8/bits/range_access.h:87:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::begin(_Tp (&)[_Nm])
     begin(_Tp (&__arr)[_Nm])
     ^
/usr/include/c++/4.8/bits/range_access.h:87:5: note:   template argument deduction/substitution failed:
componenteconexe3.cpp:14:20: note:   mismatched types '_Tp [_Nm]' and 'int'
     for(int i : G[v])

                    ^
In file included from /usr/include/c++/4.8/string:51:0,
                 from /usr/include/c++/4.8/bits/locale_classes.h:40,
                 from /usr/include/c++/4.8/bits/ios_base.h:41,
                 from /usr/include/c++/4.8/ios:42,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from componenteconexe3.cpp:1:
/usr/include/c++/4.8/bits/range_access.h:58:5: note: template<class _Container> decltype (__cont.begin()) std::begin(const _Container&)
     begin(const _Container& __cont) -> decltype(__cont.begin())
     ^
/usr/include/c++/4.8/bits/range_access.h:58:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) [with _Container = int]':
componenteconexe3.cpp:14:20:   required from here
/usr/include/c++/4.8/bits/range_access.h:58:5: error: request for member 'begin' in '__cont', which is of non-class type 'const int'
/usr/include/c++/4.8/bits/range_access.h:48:5: note: template<class _Container> decltype (__cont.begin()) std::begin(_Container&)
     begin(_Container& __cont) -> decltype(__cont.begin())
     ^
/usr/include/c++/4.8/bits/range_access.h:48:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(_Container&) [with _Container = int]':
componenteconexe3.cpp:14:20:   required from here
/usr/include/c++/4.8/bits/range_access.h:48:5: error: request for member 'begin' in '__cont', which is of non-class type 'int'
componenteconexe3.cpp:14:20: error: no matching function for call to 'end(int&)'
     for(int i : G[v])

                    ^
componenteconexe3.cpp:14:20: note: candidates are:
In file included from /usr/include/c++/4.8/bits/basic_string.h:42:0,
                 from /usr/include/c++/4.8/string:52,
                 from /usr/include/c++/4.8/bits/locale_classes.h:40,
                 from /usr/include/c++/4.8/bits/ios_base.h:41,
                 from /usr/include/c++/4.8/ios:42,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from componenteconexe3.cpp:1:
/usr/include/c++/4.8/initializer_list:99:5: note: template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>)
     end(initializer_list<_Tp> __ils) noexcept
     ^
/usr/include/c++/4.8/initializer_list:99:5: note:   template argument deduction/substitution failed:
componenteconexe3.cpp:14:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
     for(int i : G[v])

                    ^
In file included from /usr/include/c++/4.8/string:51:0,
                 from /usr/include/c++/4.8/bits/locale_classes.h:40,
                 from /usr/include/c++/4.8/bits/ios_base.h:41,
                 from /usr/include/c++/4.8/ios:42,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from componenteconexe3.cpp:1:
/usr/include/c++/4.8/bits/range_access.h:97:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm])
     end(_Tp (&__arr)[_Nm])
     ^
/usr/include/c++/4.8/bits/range_access.h:97:5: note:   template argument deduction/substitution failed:
componenteconexe3.cpp:14:20: note:   mismatched types '_Tp [_Nm]' and 'int'
     for(int i : G[v])

                    ^
In file included from /usr/include/c++/4.8/string:51:0,
                 from /usr/include/c++/4.8/bits/locale_classes.h:40,
                 from /usr/include/c++/4.8/bits/ios_base.h:41,
                 from /usr/include/c++/4.8/ios:42,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from componenteconexe3.cpp:1:
/usr/include/c++/4.8/bits/range_access.h:78:5: note: template<class _Container> decltype (__cont.end()) std::end(const _Container&)
     end(const _Container& __cont) -> decltype(__cont.end())
     ^
/usr/include/c++/4.8/bits/range_access.h:78:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(const _Container&) [with _Container = int]':
componenteconexe3.cpp:14:20:   required from here
/usr/include/c++/4.8/bits/range_access.h:78:5: error: request for member 'end' in '__cont', which is of non-class type 'const int'
/usr/include/c++/4.8/bits/range_access.h:68:5: note: template<class _Container> decltype (__cont.end()) std::end(_Container&)
     end(_Container& __cont) -> decltype(__cont.end())
     ^
/usr/include/c++/4.8/bits/range_access.h:68:5: note:   template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(_Container&) [with _Container = int]':
componenteconexe3.cpp:14:20:   required from here
/usr/include/c++/4.8/bits/range_access.h:68:5: error: request for member 'end' in '__cont', which is of non-class type 'int'
componenteconexe3.cpp: In function 'int main()':
componenteconexe3.cpp:23:14: error: request for member 'push_back' in 'G[x]', which is of non-class type 'int'
         G[x].push_back(y);

              ^
componenteconexe3.cpp:24:14: error: request for member 'push_back' in 'G[y]', which is of non-class type 'int'
         G[y].push_back(x);

              ^
componenteconexe3.cpp:32:10: error: no match for 'operator[]' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'int')
         f[C[i]]++;

          ^
componenteconexe3.cpp:36:13: error: no match for 'operator[]' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'int')
         if(f[i] > maxi) 

             ^
componenteconexe3.cpp:37:17: error: no match for 'operator[]' (operand types are 'std::ifstream {aka std::basic_ifstream<char>}' and 'int')
         maxi = f[i] , rez = i;

                 ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema ComponenteConexe3 face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

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ă.