#1707
Retea
Se consideră o rețea formată din n
servere, numerotate de la 1
la n
. În rețea există m
perechi de servere x y
cunoscute între care există legături de comunicație directe. Între oricare două servere din rețea există legături, fie directe, fie prin intermediul altor servere.
Stabiliți pentru fiecare dintre cele n
servere dacă eliminarea sa din rețea conduce la pierderea legăturii dintre cel puțin două servere rămase.
Problema | Retea | Operații I/O |
retea.in /retea.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 16 MB
|
Id soluție | #53222417 | Utilizator | |
Fișier | retea.cpp | Dimensiune | 1016 B |
Data încărcării | 21 Octombrie 2024, 19:34 | Scor / rezultat | Eroare de compilare |
retea.cpp: In function 'void dfs(int, int)': retea.cpp:14:20: error: no matching function for call to 'begin(int&)' for(int i : G[v]) ^ retea.cpp:14:20: note: candidates are: In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94:0, from retea.cpp:1: /usr/include/c++/4.8/valarray:1206:5: note: template<class _Tp> const _Tp* std::begin(const std::valarray<_Tp>&) begin(const valarray<_Tp>& __va) ^ /usr/include/c++/4.8/valarray:1206:5: note: template argument deduction/substitution failed: retea.cpp:14:20: note: mismatched types 'const std::valarray<_Tp>' and 'int' for(int i : G[v]) ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94:0, from retea.cpp:1: /usr/include/c++/4.8/valarray:1196:5: note: template<class _Tp> _Tp* std::begin(std::valarray<_Tp>&) begin(valarray<_Tp>& __va) ^ /usr/include/c++/4.8/valarray:1196:5: note: template argument deduction/substitution failed: retea.cpp:14:20: note: mismatched types 'std::valarray<_Tp>' and 'int' for(int i : G[v]) ^ 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/istream:38, from /usr/include/c++/4.8/sstream:38, 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 retea.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: retea.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/istream:38, from /usr/include/c++/4.8/sstream:38, 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 retea.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: retea.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/istream:38, from /usr/include/c++/4.8/sstream:38, 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 retea.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]': retea.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]': retea.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' retea.cpp:14:20: error: no matching function for call to 'end(int&)' for(int i : G[v]) ^ retea.cpp:14:20: note: candidates are: In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94:0, from retea.cpp:1: /usr/include/c++/4.8/valarray:1226:5: note: template<class _Tp> const _Tp* std::end(const std::valarray<_Tp>&) end(const valarray<_Tp>& __va) ^ /usr/include/c++/4.8/valarray:1226:5: note: template argument deduction/substitution failed: retea.cpp:14:20: note: mismatched types 'const std::valarray<_Tp>' and 'int' for(int i : G[v]) ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:94:0, from retea.cpp:1: /usr/include/c++/4.8/valarray:1216:5: note: template<class _Tp> _Tp* std::end(std::valarray<_Tp>&) end(valarray<_Tp>& __va) ^ /usr/include/c++/4.8/valarray:1216:5: note: template argument deduction/substitution failed: retea.cpp:14:20: note: mismatched types 'std::valarray<_Tp>' and 'int' for(int i : G[v]) ^ 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/istream:38, from /usr/include/c++/4.8/sstream:38, 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 retea.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: retea.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/istream:38, from /usr/include/c++/4.8/sstream:38, 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 retea.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: retea.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/istream:38, from /usr/include/c++/4.8/sstream:38, 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 retea.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]': retea.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]': retea.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' retea.cpp: In function 'int main()': retea.cpp:21:5: error: reference to 'cin' is ambiguous cin >> n >> m; ^ retea.cpp:5:10: note: candidates are: std::ifstream cin ifstream cin("retea.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from retea.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ retea.cpp:24:9: error: reference to 'cin' is ambiguous cin >> x >> y; ^ retea.cpp:5:10: note: candidates are: std::ifstream cin ifstream cin("retea.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from retea.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ retea.cpp:25:14: error: request for member 'push_back' in 'G[x]', which is of non-class type 'int' G[x].push_back(y); ^ retea.cpp:26:14: error: request for member 'push_back' in 'G[y]', which is of non-class type 'int' G[y].push_back(x); ^ retea.cpp:38:13: error: reference to 'cout' is ambiguous cout << ok << " "; ^ retea.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("retea.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from retea.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ retea.cpp:47:13: error: reference to 'cout' is ambiguous cout << ok << " "; ^ retea.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("retea.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from retea.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Retea 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ă.