제출 #1327083

#제출 시각아이디문제언어결과실행 시간메모리
1327083antarbanikRace (IOI11_race)C++20
9 / 100
3093 ms1532 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, int H[][2], int L[]){

    int ans = INT_MAX;

    int m = n - 1;
    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(){
//     int H[][2] = {{0,1},{1,2},{2,3},{3,4}};
//     int L[] = {3, 2, 5, 1};

//     cout<<best_path(5, 10, H, L);

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