Detalii evaluare #51998114

Rezumat problemă

Se consideră un graf neorientat cu n vârfuri și m muchii. Cele m muchii se elimină pe rând din graf. Pentru fiecare muchie eliminată trebuie să spuneți câte componente conexe are graful.

Detalii

Problema ComponenteConexe4 Operații I/O tastatură/ecran
Limita timp 1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #51998114 Utilizator Popescu Mircea (mrcpp)
Fișier componenteconexe4.cpp Dimensiune 1.39 KB
Data încărcării 15 Septembrie 2024, 14:54 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

componenteconexe4.cpp: In function 'bool union_sets(int, int)':
componenteconexe4.cpp:21:9: error: reference to 'rank' is ambiguous
     if (rank[a] < rank[b])

         ^
componenteconexe4.cpp:8:19: note: candidates are: int rank [100005]
 int parent[MAXN], rank[MAXN];

                   ^
In file included from /usr/include/c++/4.8/bits/move.h:57:0,
                 from /usr/include/c++/4.8/bits/stl_pair.h:59,
                 from /usr/include/c++/4.8/bits/stl_algobase.h:64,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from componenteconexe4.cpp:1:
/usr/include/c++/4.8/type_traits:1243:12: note:                 template<class> struct std::rank
     struct rank
            ^
componenteconexe4.cpp:21:19: error: reference to 'rank' is ambiguous
     if (rank[a] < rank[b])

                   ^
componenteconexe4.cpp:8:19: note: candidates are: int rank [100005]
 int parent[MAXN], rank[MAXN];

                   ^
In file included from /usr/include/c++/4.8/bits/move.h:57:0,
                 from /usr/include/c++/4.8/bits/stl_pair.h:59,
                 from /usr/include/c++/4.8/bits/stl_algobase.h:64,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from componenteconexe4.cpp:1:
/usr/include/c++/4.8/type_traits:1243:12: note:                 template<class> struct std::rank
     struct rank
            ^
componenteconexe4.cpp:24:9: error: reference to 'rank' is ambiguous
     if (rank[a] == rank[b])

         ^
componenteconexe4.cpp:8:19: note: candidates are: int rank [100005]
 int parent[MAXN], rank[MAXN];

                   ^
In file included from /usr/include/c++/4.8/bits/move.h:57:0,
                 from /usr/include/c++/4.8/bits/stl_pair.h:59,
                 from /usr/include/c++/4.8/bits/stl_algobase.h:64,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from componenteconexe4.cpp:1:
/usr/include/c++/4.8/type_traits:1243:12: note:                 template<class> struct std::rank
     struct rank
            ^
componenteconexe4.cpp:24:20: error: reference to 'rank' is ambiguous
     if (rank[a] == rank[b])

                    ^
componenteconexe4.cpp:8:19: note: candidates are: int rank [100005]
 int parent[MAXN], rank[MAXN];

                   ^
In file included from /usr/include/c++/4.8/bits/move.h:57:0,
                 from /usr/include/c++/4.8/bits/stl_pair.h:59,
                 from /usr/include/c++/4.8/bits/stl_algobase.h:64,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from componenteconexe4.cpp:1:
/usr/include/c++/4.8/type_traits:1243:12: note:                 template<class> struct std::rank
     struct rank
            ^
componenteconexe4.cpp:25:9: error: reference to 'rank' is ambiguous
         rank[a]++;

         ^
componenteconexe4.cpp:8:19: note: candidates are: int rank [100005]
 int parent[MAXN], rank[MAXN];

                   ^
In file included from /usr/include/c++/4.8/bits/move.h:57:0,
                 from /usr/include/c++/4.8/bits/stl_pair.h:59,
                 from /usr/include/c++/4.8/bits/stl_algobase.h:64,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from componenteconexe4.cpp:1:
/usr/include/c++/4.8/type_traits:1243:12: note:                 template<class> struct std::rank
     struct rank
            ^
componenteconexe4.cpp: In function 'int main()':
componenteconexe4.cpp:45:9: error: reference to 'rank' is ambiguous
         rank[i] = 0;

         ^
componenteconexe4.cpp:8:19: note: candidates are: int rank [100005]
 int parent[MAXN], rank[MAXN];

                   ^
In file included from /usr/include/c++/4.8/bits/move.h:57:0,
                 from /usr/include/c++/4.8/bits/stl_pair.h:59,
                 from /usr/include/c++/4.8/bits/stl_algobase.h:64,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from componenteconexe4.cpp:1:
/usr/include/c++/4.8/type_traits:1243:12: note:                 template<class> struct std::rank
     struct rank
            ^

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