#2968
conexidad
Fie un graf neorientat cu N
noduri și M
muchii, care NU este conex. Să i se adauge grafului un număr minim de muchii, astfel încât acesta să devină conex. Fie extra
i
numărul de muchii nou-adăugate care sunt incidente cu nodul i
, iar max_extra
cea mai mare dintre valorile extra
1
, extra
2
,… , extra
N
. Mulțimea de muchii adăugate trebuie să respecte condiția ca valoarea max_extra să fie minimă.
OJI 2019
Problema | conexidad | Operații I/O |
conexidad.in /conexidad.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 32 MB
|
Id soluție | #49782764 | Utilizator | |
Fișier | conexidad.cpp | Dimensiune | 1.87 KB |
Data încărcării | 14 Martie 2024, 18:17 | Scor / rezultat | Eroare de compilare |
conexidad.cpp: In function 'int main()': conexidad.cpp:55:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i =0 ; i<vec.size() ; i++,cout << "\n") ^ conexidad.cpp:56:40: error: no matching function for call to 'min(int&, std::vector<int>::size_type)' minim = min(minim,vec[i].size()); ^ conexidad.cpp:56:40: note: candidates are: 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 conexidad.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template argument deduction/substitution failed: conexidad.cpp:56:40: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type {aka unsigned int}') minim = min(minim,vec[i].size()); ^ 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 conexidad.cpp:1: /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template argument deduction/substitution failed: conexidad.cpp:56:40: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type {aka unsigned int}') minim = min(minim,vec[i].size()); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from conexidad.cpp:5: /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template<class _Tp> _Tp std::min(std::initializer_list<_Tp>) min(initializer_list<_Tp> __l) ^ /usr/include/c++/4.8/bits/stl_algo.h:4221:5: note: template argument deduction/substitution failed: conexidad.cpp:56:40: note: mismatched types 'std::initializer_list<_Tp>' and 'int' minim = min(minim,vec[i].size()); ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from conexidad.cpp:5: /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare) min(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4226:5: note: template argument deduction/substitution failed: conexidad.cpp:56:40: note: mismatched types 'std::initializer_list<_Tp>' and 'int' minim = min(minim,vec[i].size()); ^ conexidad.cpp:58:9: error: 'max_extra' was not declared in this scope max_extra = 2; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema conexidad 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ă.