Language: C++

z#include <bits/stdc++.h>

using namespace std;

// typedef
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef pair<int, int> pii;

// container util
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

// repetition
#define FOR(i,m,n) for(ll (i) = ((ll) m); (i) < ((ll) n); ++(i))
#define RFOR(i,m,n) for(ll (i) = ((ll) (m)-1); (i) >= ((ll) n); --(i))
#define REP(i,n) FOR(i,0,n)

// i/o
#define TFOUT(b,t,f) cout << ((b)? (t) : (f)) << endl

//constant
const double    EPS     = 1e-10;
const double    PI      = acos(-1.0);
const int       INFTY   = (1<<21);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

ll solve(int x, int y, const vll& cards, vvll& dp) {
    if (dp[x][y] != -1) return dp[x][y];
    if (x == cards.size()-1 || y == cards.size()-1) {
        return dp[x][y] = abs(cards[x] - cards[y]);
    }
    if (x < y) {
        ll score = -1;
        for (int nx = y+1; nx < cards.size(); nx++) {
            ll temp = solve(nx, y, cards, dp);
            if (score < temp) score = temp;
        }
        return dp[x][y] = score;
    } else {
        ll score = INFTY;
        for (int ny = x+1; ny < cards.size(); ny++) {
            ll temp = solve(x, ny, cards, dp);
            if (score > temp) score = temp;
        }
        return dp[x][y] = score;
    }
}

int main() {
    ll n, x, y; cin >> n >> x >> y;
    vll cards;
    cards.push_back(x);
    cards.push_back(y);
    REP(i, n) {
        ll e; cin >> e;
        cards.push_back(e);
    }
    vvll dp;
    REP(i, n+2) {
        dp.emplace_back(n+2, -1);
    }
    cout << solve(0, 1, cards, dp) << endl;
    return 0;
}

//
// そのままミニマックス法
// dp[x][y] = Xさんがx番目のカード, Yさんがy番目のカードを持っている時に, この先ゲームを続けた時のスコア
//

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | z#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'z' does not name a type
    1 | z#include <bits/stdc++.h>
      | ^
a.cc:7:9: error: 'vector' does not name a type
    7 | typedef vector<int> vi;
      |         ^~~~~~
a.cc:8:9: error: 'vector' does not name a type
    8 | typedef vector<vi> vvi;
      |         ^~~~~~
a.cc:9:9: error: 'vector' does not name a type
    9 | typedef vector<ll> vll;
      |         ^~~~~~
a.cc:10:9: error: 'vector' does not name a type
   10 | typedef vector<vll> vvll;
      |         ^~~~~~
a.cc:11:9: error: 'vector' does not name a type
   11 | typedef vector<string> vs;
      |         ^~~~~~
a.cc:12:9: error: 'pair' does not name a type
   12 | typedef pair<int, int> pii;
      |         ^~~~
a.cc:35:27: error: 'acos' was not declared in this scope
   35 | const double    PI      = acos(-1.0);
      |                           ^~~~
a.cc:45:30: error: 'vll' does not name a type; did you mean 'll'?
   45 | ll solve(int x, int y, const vll& cards, vvll& dp) {
      |                              ^~~
      |                              ll
a.cc:45:42: error: 'vvll' has not been declared
   45 | ll solve(int x, int y, const vll& cards, vvll& dp) {
      |                                          ^~~~
a.cc: In function 'll solve(int, int, const int&, int&)':
a.cc:46:11: error: invalid types 'int[int]' for array subscript
   46 |     if (dp[x][y] != -1) return dp[x][y];
      |           ^
a.cc:46:34: error: invalid types 'int[int]' for array subscript
   46 |     if (dp[x][y] != -1) return dp[x][y];
      |                                  ^
a.cc:47:20: error: request for member 'size' in 'cards', which is of non-class type 'const int'
   47 |     if (x == cards.size()-1 || y == cards.size()-1) {
      |                    ^~~~
a.cc:47:43: error: request for member 'size' in 'cards', which is of non-class type 'const int'
   47 |     if (x == cards.size()-1 || y == cards.size()-1) {
      |                                           ^~~~
a.cc:48:18: error: invalid types 'int[int]' for array subscript
   48 |         return dp[x][y] = abs(cards[x] - cards[y]);
      |                  ^
a.cc:48:36: error: invalid types 'const int[int]' for array subscript
   48 |         return dp[x][y] = abs(cards[x] - cards[y]);
      |                                    ^
a.cc:48:47: error: invalid types 'const int[int]' for array subscript
   48 |         return dp[x][y] = abs(cards[x] - cards[y]);
      |                                               ^
a.cc:48:27: error: 'abs' was not declared in this scope
   48 |         return dp[x][y] = abs(cards[x] - cards[y]);
      |                           ^~~
a.cc:52:39: error: request for member 'size' in 'cards', which is of non-class type 'const int'
   52 |         for (int nx = y+1; nx < cards.size(); nx++) {
      |                                       ^~~~
a.cc:56:18: error: invalid types 'int[int]' for array subscript
   56 |         return dp[x][y] = score;
      |                  ^
a.cc:59:39: error: request for member 'size' in 'cards', which is of non-class type 'const int'
   59 |         for (int ny = x+1; ny < cards.size(); ny++) {
      |                                       ^~~~
a.cc:63:18: error: invalid types 'int[int]' for array subscript
   63 |         return dp[x][y] = score;
      |                  ^
a.cc: In function 'int main()':
a.cc:68:17: error: 'cin' was not declared in this scope
   68 |     ll n, x, y; cin >> n >> x >> y;
      |                 ^~~
a.cc:69:5: error: 'vll' was not declared in this scope; did you mean 'll'?
   69 |     vll cards;
      |     ^~~
      |     ll
a.cc:70:5: error: 'cards' was not declared in this scope
   70 |     cards.push_back(x);
      |     ^~~~~
a.cc:76:5: error: 'vvll' was not declared in this scope; did you mean 'll'?
   76 |     vvll dp;
      |     ^~~~
      |     ll
a.cc:78:9: error: 'dp' was not declared in this scope
   78 |         dp.emplace_back(n+2, -1);
      |         ^~
a.cc:80:5: error: 'cout' was not declared in this scope
   80 |     cout << solve(0, 1, cards, dp) << endl;
      |     ^~~~
a.cc:80:32: error: 'dp' was not declared in this scope
   80 |     cout << solve(0, 1, cards, dp) << endl;
      |                                ^~
a.cc:80:39: error: 'endl' was not declared in this scope
   80 |     cout << solve(0, 1, cards, dp) << endl;
      |                                       ^~~~