Submission #719250

#TimeUsernameProblemLanguageResultExecution timeMemory
719250Osplei경주 (Race) (IOI11_race)C++17
0 / 100
0 ms212 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...