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;
typedef long long ll;
typedef vector<ll> vi;
ll sum=0;
int opt;
int len=0;
int best_path(int n, int k, int h[][2], int l[]){
opt=n+1;
for(int i=0; i<n-1; i++){
sum=0;
len=0;
for(int j=i; j<n-1; j++){
sum+=l[j];
len++;
// cout<<len<<endl;
//cout<<sum<<" "<<len<<" "<<j<<endl;
if(sum==k) {opt=min(opt,len);
break;}
}
}
if(opt>n) opt=-1;
return opt;
}
# | 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... |