#589
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 drumurilor 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 | #63399905 | Utilizator | |
| Fișier | roy-floyd.cpp | Dimensiune | 873 B |
| Data încărcării | 01 Martie 2026, 22:06 | Scor/rezultat | Eroare de compilare |
roy-floyd.cpp:9:14: warning: missing terminating " character [enabled by default] ofstream out("roy-floyd.out); ^ roy-floyd.cpp:9:1: error: missing terminating " character ofstream out("roy-floyd.out); ^ roy-floyd.cpp:11:18: error: 'i' has not been declared int v[105][105], i, j, n, m; ^ roy-floyd.cpp:11:21: error: 'j' has not been declared int v[105][105], i, j, n, m; ^ roy-floyd.cpp:11:24: error: 'n' has not been declared int v[105][105], i, j, n, m; ^ roy-floyd.cpp:11:27: error: 'm' has not been declared int v[105][105], i, j, n, m; ^ roy-floyd.cpp:11:28: error: expected ')' before ';' token int v[105][105], i, j, n, m; ^ roy-floyd.cpp: In function 'int main()': roy-floyd.cpp:15:12: error: 'n' was not declared in this scope cin >> n >> m; ^ roy-floyd.cpp:15:17: error: 'm' was not declared in this scope cin >> n >> m; ^ roy-floyd.cpp:16:9: error: 'i' was not declared in this scope for(i = 1; i <= n; ++i) ^ roy-floyd.cpp:17:9: error: 'j' was not declared in this scope for(j = 1; j <= n; ++j) { ^ roy-floyd.cpp:18:20: error: 'v' was not declared in this scope if(i == j) v[i][j] = 0; ^ roy-floyd.cpp:19:14: error: 'v' was not declared in this scope else v[i][j] = INF; ^ roy-floyd.cpp:21:9: error: 'i' was not declared in this scope for(i = 1; i <= m; ++i) { ^ roy-floyd.cpp:24:9: error: 'v' was not declared in this scope v[a][b] = c; ^ roy-floyd.cpp:28:9: error: 'i' was not declared in this scope for(i = 1; i <= n; ++i) ^ roy-floyd.cpp:29:9: error: 'j' was not declared in this scope for(j = 1; j <= n; ++j) { ^ roy-floyd.cpp:30:12: error: 'v' was not declared in this scope if(v[i][k] + v[k][j] < v[i][j] ) ^ roy-floyd.cpp:33:9: error: 'i' was not declared in this scope for(i = 1; i <= n; ++i) { ^ roy-floyd.cpp:34:13: error: 'j' was not declared in this scope for(j = 1; j <= n; ++j) ^ roy-floyd.cpp:35:16: error: 'v' was not declared in this scope if(v[i][j] == INF) cout << -1 << ' '; ^ roy-floyd.cpp:35:41: error: invalid operands of types 'std::ofstream(int (*)[105], int, int, int, int) {aka std::basic_ofstream<char>(int (*)[105], int, int, int, int)}' and 'int' to binary 'operator<<' if(v[i][j] == INF) cout << -1 << ' '; ^ roy-floyd.cpp:37:17: error: invalid operands of types 'std::ofstream(int (*)[105], int, int, int, int) {aka std::basic_ofstream<char>(int (*)[105], int, int, int, int)}' and 'char' to binary 'operator<<' cout << '\n'; ^
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ă.