Submission #1213775

#TimeUsernameProblemLanguageResultExecution timeMemory
121377512baaterRace (IOI11_race)C++20
9 / 100
18 ms1604 KiB
#include "race.h"
#include <iostream>

using namespace std;

int best_path(int N, int K, int H[][2], int L[]) {
  int current = 0;
  int currentPaths = 0;
  int best = 2000000000;
  
  for(int i = 0; i < N; i++) {
    current += L[i];
    currentPaths++;
    if(current == K && currentPaths > 0) {
      best = min(best, currentPaths);
    }
    while (current >= K) {
      currentPaths--;
      current -= L[i-currentPaths];
      if(current == K && currentPaths > 0) {
        best = min(best, currentPaths);
      }
    }
  }

  return (best==2000000000) ? -1 : best;
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...