title: Print Maximum Shortest Distance
signature: func printMaximumShortestDistance(a []int, n int, k int) int64 {
source_py: def print_maximum_shortest_distance(a, n, k):
      b = dict()
      for i in range(n):
          x = a[i]
          d = min((1 + i), (n - i))
          if (x not in b.keys()):
              b[x] = d
          else:
              b[x] = min(d, b[x])
      ans = (10 ** 9)
      for i in range(n):
          x = a[i]
          if ((x != (k - x)) and ((k - x) in b.keys())):
              ans = min(max(b[x], b[(k - x)]), ans)
      return ans
source_cpp: int print_maximum_shortest_distance(vector<int> a, int n, int k) {
    unordered_map < int, int > b;
    for ( int i = 0;
    i < n;
    i ++ ) {
      int x = a [ i ];
      int d = min ( 1 + i, n - i );
      if ( b . find ( x ) == b . end ( ) ) b [ x ] = d;
      else b [ x ] = min ( d, b [ x ] );
    }
    int ans = INT_MAX;
    for ( int i = 0;
    i < n;
    i ++ ) {
      int x = a [ i ];
      if ( x != k - x && b . find ( k - x ) != b . end ( ) ) ans = min ( max ( b [ x ], b [ k - x ] ), ans );
    }
    return ans;
  }