# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
238486 | Sorting | Restore Array (RMI19_restore) | C++14 | 378 ms | 1088 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int k_N = 5000 + 3;
const int k_M = 10000 + 3;
const int k_Inf = 1e9 + 3;
int n, m;
vector<array<int, 3>> edges;
int prefix[k_N];
bool bellman_ford(){
prefix[0] = 0;
for(int i = 1; i <= n; ++i)
prefix[i] = k_Inf;
for(int i = 0; i < n; ++i){
for(auto &edge: edges){
int new_prefix = prefix[edge[0]] + edge[2];
prefix[edge[1]] = min(new_prefix, prefix[edge[1]]);
}
}
for(auto &edge: edges){
int new_prefix = prefix[edge[0]] + edge[2];
if(new_prefix < prefix[edge[1]])
return false;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |