Submission #719257

#TimeUsernameProblemLanguageResultExecution timeMemory
719257OspleiRace (IOI11_race)C++17
9 / 100
23 ms1876 KiB
#include "race.h"
#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;
  bool puede=false;
  
  suma[0]=0;
  for (int i=0; i<n; i++) suma[i+1]=suma[i]+l[i];

  for (int i=0; i<=n; i++){
    if (puede==true) break;
    for (int j=0; j<=n-i; j++){
      if (i+j<=n && suma[i+j]-suma[j]==k){
        ans=i;
        puede=true;
        break;
      }
    }
  }
  
  if (puede==true) return ans;
  return -1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...