Submission #139448

#TimeUsernameProblemLanguageResultExecution timeMemory
139448redaRace (IOI11_race)C++14
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> #include "race.h" using namespace std ; int best_path(int N,int K,int h[][2],int L[]) { int sum[N+1]; for(int i= 0 ;i < N ;i++)sum[i]=0; for(int i = 0 ;i < N-1 ;i++) { sum[i]+=L[i]; sum[i+1]+=sum[i]; } int ans= -1e9+7; for(int i=0;i<N-1;i++) for(int j=i;j<N-1;j++) { if(!i) { if(sum[j]==K&&(j-i+1<ans||ans==-1e9+7)) ans=j-i+1; } else if(sum[j]-sum[i-1]==K&&(j-i+1<ans||ans==-1e9+7)) ans=j-i+1; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...