제출 #1210816

#제출 시각아이디문제언어결과실행 시간메모리
1210816islam_2010경주 (Race) (IOI11_race)C++20
컴파일 에러
0 ms0 KiB
#pragma GCC optimize("O3")
#include "race.h"
#include <bits/stdc++.h>
using namespace std;

const int sz = 1e5+5;

int best_path(int n, int k, int h[][2], int l[]){
    int s = 0;
    int mn = INT_MAX;
    int le = 0;
    for(int i = 0; i < n-1; i++){
        s+=l[i];
        while(s>k){
            s-=l[le++];
        }if(sum == k){
            mn = min(mn, i-le+1);
        }
    }return (mn == INT_MAX ? -1 : mn);
}

컴파일 시 표준 에러 (stderr) 메시지

race.cpp: In function 'int best_path(int, int, int (*)[2], int*)':
race.cpp:16:13: error: 'sum' was not declared in this scope
   16 |         }if(sum == k){
      |             ^~~