Pagini recente » Cod sursa (job #1386658) | Cod sursa (job #277224) | Cod sursa (job #286183) | Cod sursa (job #879460) | Cod sursa (job #2951458)
#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!";
}
/*
*/