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 pair<int,int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> wgraf;
typedef pair<int,ii> edge;
typedef vector <ll> vl;
typedef pair <ll, ll> LL;
typedef vector <LL> vll;
#define UNVISITED 0
#define VISITED 1
#define pb push_back
#define F first
#define S second
int best_path(int n, int k, int h[][2], int l[]){
int suma[n+5], ans;
suma[0]=0;
for (ll i=1; i<=n; i++) suma[i]=suma[i-1]+l[i-1];
bool puede=false;
for (ll i=0; i<=n; i++){
if (puede==true) break;
for (ll j=0; j<=n-i; j++){
if (i+j<=n && suma[i+j]-suma[i]==k){
ans=i;
puede=true;
break;
}
}
}
if (puede==true) return ans;
return -1;
}
# | 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... |