#589
Roy-Floyd
Se dă un graf orientat ponderat cu n
noduri și m
arce – în care fiecare arc are asociat un cost, număr natural strict pozitiv. Folosind algoritmul Roy-Floyd, construiți matricea costurilor minime.
Problema | Roy-Floyd | Operații I/O |
![]() roy-floyd.in /roy-floyd.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #29660067 | Utilizator | |
Fișier | roy-floyd.cpp | Dimensiune | 901 B |
Data încărcării | 14 Mai 2021, 10:35 | Scor / rezultat | Eroare de compilare |
roy-floyd.cpp: In function 'int main()': roy-floyd.cpp:22:5: error: reference to 'cin' is ambiguous cin >> n >> m; ^ roy-floyd.cpp:5:10: note: candidates are: std::ifstream cin ifstream cin("roy-floyd.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from roy-floyd.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ roy-floyd.cpp:26:35: error: reference to 'max' is ambiguous if (i != j) v[i][j] = max; ^ roy-floyd.cpp:8:11: note: candidates are: const int max const int max = 0x3f3f3f3f; ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from roy-floyd.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare) max(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^ 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/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 roy-floyd.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) ^ roy-floyd.cpp:30:9: error: reference to 'cin' is ambiguous cin >> x >> y >> w; ^ roy-floyd.cpp:5:10: note: candidates are: std::ifstream cin ifstream cin("roy-floyd.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from roy-floyd.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ roy-floyd.cpp:39:27: error: reference to 'max' is ambiguous if(v[i][j] != max)cout << v[i][j] << ' '; ^ roy-floyd.cpp:8:11: note: candidates are: const int max const int max = 0x3f3f3f3f; ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:64, from roy-floyd.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare) max(initializer_list<_Tp> __l, _Compare __comp) ^ /usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>) max(initializer_list<_Tp> __l) ^ 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/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 roy-floyd.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) ^ roy-floyd.cpp:39:31: error: reference to 'cout' is ambiguous if(v[i][j] != max)cout << v[i][j] << ' '; ^ roy-floyd.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("roy-floyd.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from roy-floyd.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ roy-floyd.cpp:40:18: error: reference to 'cout' is ambiguous else cout << "-1 "; ^ roy-floyd.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("roy-floyd.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from roy-floyd.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ roy-floyd.cpp:41:9: error: reference to 'cout' is ambiguous cout << '\n'; ^ roy-floyd.cpp:6:10: note: candidates are: std::ofstream cout ofstream cout("roy-floyd.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from roy-floyd.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 Roy-Floyd 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ă.