Cod sursa(job #2951458)

Utilizator CiuiGinjoveanu Dragos Ciui Data 6 decembrie 2022 14:23:32
Problema Algoritmul Bellman-Ford Scor 10
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 1.06 kb
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <deque>
#include <vector>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
using namespace std;

ifstream fin("bellmanford.in");
ofstream fout("bellmanford.out");

const int MAX_SIZE = 50000;

vector<pair<int, long long>> graph[MAX_SIZE + 1];
long long costs[MAX_SIZE + 1];
int ok;

void findMinCosts(int actPeak) {
    for (pair<int, long long> next : graph[actPeak]) {
        int nextPeak = next.first;
        long long archCost = next.second;
        if (costs[actPeak] + archCost < costs[nextPeak]) {
            costs[nextPeak] = costs[actPeak] + archCost;
            ok = 0;
        }
    }
}

int main() {
    int peaks, arches;
    fin >> peaks >> arches;
    for (int i = 1; i <= arches; ++i) {
        int start, end;
        long long cost;
        fin >> start >> end >> cost;
        graph[start].push_back(make_pair(end, cost));
    }
    fout << "Ciclu negativ!";
}

/*

 
 
 
 
 */