#588
Dijkstra
Se dă un graf orientat ponderat – în care fiecare arc are asociat un cost, număr natural strict pozitiv, și un nod p
. Să se determine, folosind algoritmul lui Dijkstra, costul minim al drumului de la p
la fiecare nod al grafului.
Problema | Dijkstra | Operații I/O |
![]() dijkstra.in /dijkstra.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #50530868 | Utilizator | |
Fișier | dijkstra.c | Dimensiune | 1.84 KB |
Data încărcării | 13 Aprilie 2024, 14:22 | Scor / rezultat | Eroare de compilare |
dijkstra.c:13:1: error: unknown type name 'graphMatrix' graphMatrix readGraph(FILE* f) ^ dijkstra.c: In function 'readGraph': dijkstra.c:15:2: error: unknown type name 'graphMatrix' graphMatrix graph; ^ dijkstra.c:16:26: error: request for member 'numberNodes' in something not a structure or union fscanf(f, "%d%d", &graph.numberNodes, &graph.nodeStart); ^ dijkstra.c:16:46: error: request for member 'nodeStart' in something not a structure or union fscanf(f, "%d%d", &graph.numberNodes, &graph.nodeStart); ^ dijkstra.c:18:7: error: request for member 'cost' in something not a structure or union graph.cost = (int**)malloc(sizeof(int*) * (graph.numberNodes+1)); ^ dijkstra.c:18:50: error: request for member 'numberNodes' in something not a structure or union graph.cost = (int**)malloc(sizeof(int*) * (graph.numberNodes+1)); ^ dijkstra.c:19:26: error: request for member 'numberNodes' in something not a structure or union for (int i = 0;i < graph.numberNodes+1;i++) ^ dijkstra.c:21:8: error: request for member 'cost' in something not a structure or union graph.cost[i] = (int*)malloc(sizeof(int) * (graph.numberNodes + 1)); ^ dijkstra.c:21:52: error: request for member 'numberNodes' in something not a structure or union graph.cost[i] = (int*)malloc(sizeof(int) * (graph.numberNodes + 1)); ^ dijkstra.c:24:27: error: request for member 'numberNodes' in something not a structure or union for (int i = 1;i <= graph.numberNodes;i++) ^ dijkstra.c:26:28: error: request for member 'numberNodes' in something not a structure or union for (int j = 1;j <= graph.numberNodes;j++) ^ dijkstra.c:28:21: error: request for member 'cost' in something not a structure or union if (i == j) graph.cost[i][j] = 0; ^ dijkstra.c:29:14: error: request for member 'cost' in something not a structure or union else graph.cost[i][j] = INF; ^ dijkstra.c:36:8: error: request for member 'cost' in something not a structure or union graph.cost[x][y] = z; ^ dijkstra.c: At top level: dijkstra.c:58:15: error: unknown type name 'graphMatrix' void Dijkstra(graphMatrix graph,FILE *g) ^ dijkstra.c: In function 'main': dijkstra.c:102:2: error: unknown type name 'graphMatrix' graphMatrix graph = readGraph(f); ^ dijkstra.c:104:2: warning: implicit declaration of function 'Dijkstra' [-Wimplicit-function-declaration] Dijkstra(graph,g); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Dijkstra 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ă.