Cod sursa(job #406981)

Utilizator vasilemureVasile Mure vasilemure Data 1 martie 2010 22:39:07
Problema Algoritmul Bellman-Ford Scor 10
Compilator cpp Status done
Runda Arhiva educationala Marime 0.51 kb
#include <stdio.h>
#include <vector>

#define Nmax 50005

using namespace std;

vector < pair <int, int> > A[Nmax];

int sol[Nmax], d[5*Nmax], viz[Nmax];
int n, m, i, a, b, c, p, u, nod, l, fiu;

int main (){
	FILE * f = fopen ("bellmanford.in", "r");
	FILE * g = fopen ("bellmanford.out","w");
		
	fscanf (f, "%d %d", &n, &m);
	for (i = 1 ; i <= m ; i++){
		fscanf (f, "%d %d %d", &a, &b, &c);
		A[a].push_back ( make_pair (b, c) );		
	}
	
	fprintf (g, "Ciclu negativ!");
	
	fclose(g);
	return 0;
}