#include<bits/stdc++.h>
#define N 20005
using namespace std;
int f[N][2],n,Z,W,a[N];bool vis[N][2];
int dp(int last,int who){
if (vis[last][who]) return f[last][who];
int ret=abs(a[n]-a[last]);
vis[last][who]=1;
if (!who){
for (int i=last+1;i<n;i++) ret=max(ret,abs(dp(i,!who)));
return f[last][who]=ret;
}
if (who){
for (int i=last+1;i<n;i++) ret=min(ret,abs(dp(i,!who)));
return f[last][who]=ret;
}
}
int main(){
scanf("%d%d%d",&n,&Z,&W);a[0]=W;
for (int i=1;i<=n;i++) scanf("%d",&a[i]);
printf("%d\n",abs(dp(0,0)));
return 0;
}
./Main.cpp: In function ‘int main()’:
./Main.cpp:19:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d",&n,&Z,&W);a[0]=W;
^
./Main.cpp:20:42: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for (int i=1;i<=n;i++) scanf("%d",&a[i]);
^