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;
int best_path(int n, int k, int h[][2], int L[])
{
int arr[110];
for (int i = 0; i < n-1; i++)
{
arr[h[i][0]] = L[i];
}
int minEdges = 1e9;
for (int i = 0; i < n; i++)
{
for (int j = i + 1; j < n; j++)
{
int d = 0;
for (int k = i; k < j; k++)
{
d += arr[k];
}
if (d == k)
{
minEdges = min(minEdges, j-i);
//cout<<minEdges<<endl;
}
}
}
return minEdges;
}
# | 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... |