제출 #1323723

#제출 시각아이디문제언어결과실행 시간메모리
1323723Trisanu_Das경주 (Race) (IOI11_race)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int best_path(int N, int K, int H[][2], int L[]){ int ans = N + 1; for(int i = 0; i < N - 1; i++){ for(int j = i + 1; j < N - 1; j++){ int curr = 0; for(int k = i; k <= j; k++) curr += L[k]; if(curr == k) ans = min(ans, j - i); } } if(ans == N + 1) return -1; else return ans; }

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

race.cpp: In function 'int best_path(int, int, int (*)[2], int*)':
race.cpp:11:24: error: 'k' was not declared in this scope
   11 |             if(curr == k) ans = min(ans, j - i);
      |                        ^