제출 #1303613

#제출 시각아이디문제언어결과실행 시간메모리
1303613mdobric경주 (Race) (IOI11_race)C++20
9 / 100
16 ms1528 KiB
#include "race.h" #include <bits/stdc++.h> using namespace std; const int maxn = 200005; int ans = 1e9; int best_path (int n, int k, int h[maxn][2], int l[maxn]){ for (int i = 0; i < n - 1; i++){ int duljina = 0; for (int j = i; j < n - 1; j++){ duljina += l[j]; if (duljina > k) break; if (duljina == k) ans = min(ans, j - i + 1); } } if (ans == 1e9) return -1; else return ans; } /* int main (void){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, k, h[maxn][2], l[maxn]; cin >> n >> k; for (int i = 0; i < n - 1; i++) cin >> h[i][0] >> h[i][1] >> l[i]; cout << best_path(n, k, h, l) << endl; return 0; } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...