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 "race.h"
#include <iostream>
#define maxn 200001
int sum[maxn];
int ans=9999999;
int best_path(int n, int K, int H[][2], int L[])
{
for(int i=0;i<maxn;i++)sum[i]=0;
for(int i=0;i<n;i++)
{
sum[i]+=L[i];
sum[i+1]+=sum[i];
}
for(int i=0;i<n;i++)
for(int j=i+1;j<n;j++)
{
if(i==0)
{
if(sum[j]==K&&j-i+1<ans)ans=j-i+1;
}
else if(sum[j]-sum[i-1]==K&&j-i+1<ans)ans=j-i+1;
}
return ans;
}
# | 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... |