Using your notation, one can work explicitly as follows. Let $s_A = \sum_{i \in A} |x_i - y_i|$ and $s_B = \sum_{i \in B} |x_i - y_i|$. Then 

$$\displaystyle s_A - s_B = \sum_{i \in A} (x_i - y_i) - \sum_{i \in B} (y_i - x_i) = n - n = 0,$$

hence $s_A = s_B = s$. Note that $s \leq n$ (this cannot be improved by much in general: say $x_1 = n, x_i = 0$ for $i = 2, \cdots, n$ and $y_i = 1$ for $i = 1, \cdots, n$). Thus by your AM-GM argument one gets 

$$\displaystyle \prod_{i = 1}^n |x_i - y_i| \leq s^n (n-x)^{x-n} x^{-x}$$

for $x = |A|$. The latter function can be optimized to give an upper bound of $(2s/n)^n$. This is slightly better than the bound given by Denis Serre, which takes the value $s = n$. 

Edit: I believe the following almost solves the problem. Note that the problem is trivial if $x_i = y_i$ for some $i$, so we assume that this is not the case. Without loss of generality, we suppose $x_1 > y_1$ and let $1, \cdots, m_1$ be the longest consecutive string containing 1 which lies in $A$. Then by AM-GM, we have

$$\displaystyle \prod_{i=1}^{m_1} (x_i - y_i) \leq \left(\frac{\sum_{i=1}^{m_1} (x_i - y_i)}{m_1}\right)^{m_1}.$$

Now replace $x_i, 1 \leq i \leq m_1$ by $u_1 = m_1^{-1} \sum_{i=1}^{m_1} x_i$ and likewise replace $y_i$ with the average of the first $m_1$ $y_i$'s. Note that the new sequence still satisfies the condition of the original problem, but the product is now larger. We do the same thing for the string $m_1 + 1, \cdots, m_2$, the longest consecutive string in $B$ containing $m_1 + 1$. Having done so, we now obtain a new sequence as follows:

$$u^{(1)} = u_1 = u_2 = \cdots = u_{m_1}, u^{(2)} = u_{m_1 + 1} = \cdots = u_{m_2}, \cdots,$$
$$v^{(1)} = v_1 = v_2 = \cdots = v_{m_1}, v^{(2)} = v_{m_1 + 1} = \cdots = v_{m_2}, \cdots$$

with the property that the sets of indices $A,B$ remain the same. Now we glue together consecutive blocks as follows. Take the first two blocks and replace each $v_i$ by the average of $v_1, \cdots, v_{m_2}$. Thus, we have replaced the values $v^{(1)}, v^{(2)}$ by their average. Indeed, this continues to preserve the conditions of the problem but enlarging each $|u_i - v_i|$. Do so with each pair of subsequent consecutive blocks. 

Now this part I am not sure how to write up properly, so I will just sketch the idea. One observes that for small $i$ the terms $x_i, y_i$ contribute disproportionately to the total sum (due to the monotonicity), so one wants to lower/narrow the left most blocks with large height; likewise the rightmost blocks with small height. Doing so one eventually concludes that the optimal configuration consists of just two blocks. Then our construction tells us that $y_1 = \cdots = y_n = 1$. Let $k = m_1$ (and $m_2 = n$). We can assume that $x_i = 0$ for $i > k$; otherwise the right blocks make the product smaller. Thus our construction yields that $x_1 = \cdots = x_k = n/k$. It then follows that our product is equal to

$$\displaystyle P(n,k) = \left(\frac{n}{k} - 1\right)^k.$$

The inequality $P(n,k) < e^{n/2}$ is equivalent to

$$\displaystyle \log\left(\frac{n}{k} - 1\right) < \frac{n}{2k}.$$

Put $s = n/k - 1$. We are then left to consider $\log(s) < (s+1)/2$. This inequality is immediately verified by calculus.