Submission #139449

#TimeUsernameProblemLanguageResultExecution timeMemory
139449redaRace (IOI11_race)C++14
Compilation error
0 ms0 KiB
#include "race.h" #include <iostream> using namespace std; int best_path(int n, int K, int H[][2], int L[]) { int sum[n+1]; int ans=-1; for(int i=0;i<maxn;i++)sum[i]=0; for(int i=0;i<n-1;i++) { sum[i]+=L[i]; sum[i+1]+=sum[i]; } for(int i=0;i<n-1;i++) for(int j=i;j<n-1;j++) { if(i==0) { if(sum[j]==K&&(j-i+1<ans||ans==-1))ans=j-i+1; } else if(sum[j]-sum[i-1]==K&&(j-i+1<ans||ans==-1))ans=j-i+1; } return ans; }

Compilation message (stderr)

race.cpp: In function 'int best_path(int, int, int (*)[2], int*)':
race.cpp:11:16: error: 'maxn' was not declared in this scope
  for(int i=0;i<maxn;i++)sum[i]=0;
                ^~~~