Submission #719191

#TimeUsernameProblemLanguageResultExecution timeMemory
719191ChrisM2309Race (IOI11_race)C++17
9 / 100
36 ms3160 KiB
#include "race.h" #include<bits/stdc++.h> using namespace std; int best_path(int N, int K, int H[][2], int L[]) { int psum[N]; psum[0] = 0; for (int i = 0; i < N; i++){ psum[i+1] = psum[i] + L[i]; } //for (auto x : psum) cout << x << " "; bool found = false; int ans = -1; for (int d = 0; d <= N; d++){ if(found) break; for (int i = 0; i <= N - d; i++){ if(i + d <= N){ if(psum[i + d] - psum[i] == K){ ans = d; //cout << i + d << " " << i << "\n"; found = true; break; } } } } if(!found) return -1; //cout << ans; 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...