Pagini recente » Borderou de evaluare (job #1777690) | Borderou de evaluare (job #1661519) | Cod sursa (job #640644) | Cod sursa (job #2825452) | Cod sursa (job #470822)
Cod sursa(job #470822)
#include <cstdio>
#include <cstdlib>
#define MAXN 50010
#define MAXM 250010
#define INF 2147483647
struct node {
int dest, cost;
node *next;
};
inline void read(node *graph, int *N, int *M){
int a, b, c;
node *aux;
scanf("%d%d", N, M);
for(i = 0; i < M; i++){
scanf("%d%d%d", &a, &b, &c);
aux = new node;
aux->dest = b;
aux->cost = c;
aux->next = graph[a];
graph[a] = aux;
}
}
// add new element tot the heap
void addheap(int *heap, int *size, int value){}
// delete heap root
int rootheap(int *heap, int *size){}
int main(){
freopen("dijkstra.in", "r", stdin);
//freopen("dijkstra.out", "w", stdout);
node *graph[MAXN];
int dist[MAXN], heap[MAXN];
bool visited[MAXN];
int N, M, aux, k, min;
read(graph, &N, &M);
memset(dist+1, INF, sizeof(int)*N);
memset(visited, false, sizeof(bool)*N);
dist[1] = 0; k = 1; heap[k] = 1;
// while heap isn't emty
while(k){
min = heap[1];
rootheap(heap, *size);
}
return 0;
}