#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 | #54720898 | Utilizator | |
Fișier | roy-floyd.cpp | Dimensiune | 1.45 KB |
Data încărcării | 06 Decembrie 2024, 11:31 | Scor / rezultat | Eroare de compilare |
roy-floyd.cpp:9:1: error: expected ',' or ';' before 'int' int n, m, start, A[105][105], C[105], T[105]; ^ roy-floyd.cpp: In function 'void DIJ(int)': roy-floyd.cpp:13:21: error: 'n' was not declared in this scope for(int i=1; i<=n; i++) T[i]=0; ^ roy-floyd.cpp:13:29: error: 'T' was not declared in this scope for(int i=1; i<=n; i++) T[i]=0; ^ roy-floyd.cpp:14:21: error: 'n' was not declared in this scope for(int i=1; i<=n; i++) C[i]=inf; ^ roy-floyd.cpp:14:29: error: 'C' was not declared in this scope for(int i=1; i<=n; i++) C[i]=inf; ^ roy-floyd.cpp:15:21: error: 'n' was not declared in this scope for(int i=1; i<=n; i++){ ^ roy-floyd.cpp:16:12: error: 'A' was not declared in this scope if(A[start][i]<inf){ ^ roy-floyd.cpp:17:13: error: 'T' was not declared in this scope T[i]=start; ^ roy-floyd.cpp:20:13: error: 'T' was not declared in this scope T[i]=-1; ^ roy-floyd.cpp:22:9: error: 'C' was not declared in this scope C[i]=A[start][i]; ^ roy-floyd.cpp:22:14: error: 'A' was not declared in this scope C[i]=A[start][i]; ^ roy-floyd.cpp:27:24: error: 'n' was not declared in this scope for(int pas=1; pas<n; pas++){ ^ roy-floyd.cpp:31:23: error: 'C' was not declared in this scope if(mn>C[i]) ^ roy-floyd.cpp:35:16: error: 'C' was not declared in this scope if(C[i]>C[x]+A[x][i]){ ^ roy-floyd.cpp:35:26: error: 'A' was not declared in this scope if(C[i]>C[x]+A[x][i]){ ^ roy-floyd.cpp:37:17: error: 'T' was not declared in this scope T[i]=x; ^ roy-floyd.cpp:41:21: error: 'n' was not declared in this scope for(int i=1; i<=n; i++) ^ roy-floyd.cpp:42:8: error: 'C' was not declared in this scope if(C[i]==inf) cout<<-1<<' '; ^ roy-floyd.cpp: In function 'int main()': roy-floyd.cpp:49:10: error: 'n' was not declared in this scope cin>>n>>m; ^ roy-floyd.cpp:49:13: error: 'm' was not declared in this scope cin>>n>>m; ^ roy-floyd.cpp:54:13: error: 'A' was not declared in this scope A[i][j]=inf; ^ roy-floyd.cpp:57:9: error: 'A' was not declared in this scope A[i][i]=0; ^ roy-floyd.cpp:60:9: error: 'A' was not declared in this scope A[x][y]=c; ^ roy-floyd.cpp:65:20: error: 'A' was not declared in this scope if(A[i][j]>A[i][k]+A[k][j]) ^
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ă.