Submission #1210813

#TimeUsernameProblemLanguageResultExecution timeMemory
1210813islam_2010Race (IOI11_race)C++20
Compilation error
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 l = 0;
    for(int i = 0; i < n-1; i++){
        s+=a[i];
        while(s>k){
            s-=a[l++];
        }if(sum == k){
            mn = min(mn, i-l+1);
        }
    }return (mn == INT_MAX ? -1 : mn);
}

Compilation message (stderr)

race.cpp: In function 'int best_path(int, int, int (*)[2], int*)':
race.cpp:11:9: error: declaration of 'int l' shadows a parameter
   11 |     int l = 0;
      |         ^
race.cpp:8:45: note: 'int* l' previously declared here
    8 | int best_path(int n, int k, int h[][2], int l[]){
      |                                         ~~~~^~~
race.cpp:13:12: error: 'a' was not declared in this scope
   13 |         s+=a[i];
      |            ^
race.cpp:16:13: error: 'sum' was not declared in this scope
   16 |         }if(sum == k){
      |             ^~~