| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1327082 | antarbanik | 경주 (Race) (IOI11_race) | C++20 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define yes cout << "YES\n";
#define nl cout << endl;
#define no cout << "NO\n";
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define pb push_back
#define ppb pop_back
// #define mp make_pair
#define ff first
#define ss second
#define st string
int best_path(int n, int k, vector<vector<int>> H, vector<int> L){
int ans = INT_MAX;
int m = L.size();
for(int i = 0;i<m;++i){
int s = 0;
for(int j = i;j<m;++j){
s += L[j];
if(s == k){
ans = min(ans, j - i + 1);
}
}
}
if(ans == INT_MAX) ans = -1;
return ans;
}
// int main(){
// cout<<best_path(5, 10, {{0,1},{1,2},{2,3},{3,4}}, {3, 2, 5, 1});
// }