#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 | #64070084 | Utilizator | |
| Fișier | roy-floyd.cpp | Dimensiune | 705 B |
| Data încărcării | 15 Aprilie 2026, 13:24 | Scor/rezultat | Eroare de compilare |
roy-floyd.cpp:5:15: warning: overflow in conversion from ‘long int’ to ‘int’ changes value from ‘100000000000’ to ‘1215752192’ [-Woverflow] 5 | const int inf=100000000000; | ^~~~~~~~~~~~ roy-floyd.cpp: In function ‘int main()’: roy-floyd.cpp:9:14: warning: too many arguments for format [-Wformat-extra-args] 9 | fscanf(f,"%d&d",&n,&m); | ^~~~~~ roy-floyd.cpp:10:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 10 | for(int i=1;i<=n;i++) | ^~~ roy-floyd.cpp:13:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 13 | for(int(i=1;i<=m;i++) | ^~~ roy-floyd.cpp:13:17: error: ‘i’ was not declared in this scope 13 | for(int(i=1;i<=m;i++) | ^ roy-floyd.cpp:14:24: warning: format ‘%d’ expects argument of type ‘int*’, but argument 4 has type ‘int’ [-Wformat=] 14 | while(fscanf(f,"%d%d%d",&x,y,&cost)==3) | ~^ ~ | | | | int* int roy-floyd.cpp:17:18: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 17 | for(int k=1;k=n;k++) | ~^~ roy-floyd.cpp:9:11: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | fscanf(f,"%d&d",&n,&m); | ~~~~~~^~~~~~~~~~~~~~~~
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ă.