You are right. Here is an appropriate potential function, which unfortunately is not easy to describe.
Let
![$M=A\cup B$ $M=A\cup B$](https://dxdy-04.korotkov.co.uk/f/f/6/6/f66337b0825e62e33176cf65f41d541482.png)
and for every
![$x\in M$ $x\in M$](https://dxdy-03.korotkov.co.uk/f/a/3/d/a3d71bbb900edbc5bd0245a936f8704982.png)
define
![$C_x = \{ y\in M : d(x,y) = \min_{z\ne x} d(x,z) \}$ $C_x = \{ y\in M : d(x,y) = \min_{z\ne x} d(x,z) \}$](https://dxdy-01.korotkov.co.uk/f/0/9/4/094dc9b342c6fddcaffbf4556ff9900a82.png)
as the set of points closest to
![$x$ $x$](https://dxdy-04.korotkov.co.uk/f/3/3/2/332cc365a4987aacce0ead01b8bdcc0b82.png)
.
Define a graph
![$G$ $G$](https://dxdy-02.korotkov.co.uk/f/5/2/0/5201385589993766eea584cd3aa6fa1382.png)
whose vertices are the elements of
![$M$ $M$](https://dxdy-04.korotkov.co.uk/f/f/b/9/fb97d38bcc19230b0acd442e17db879c82.png)
and every vertex
![$x\in M$ $x\in M$](https://dxdy-03.korotkov.co.uk/f/a/3/d/a3d71bbb900edbc5bd0245a936f8704982.png)
has incident edges
![$(x,y)$ $(x,y)$](https://dxdy-04.korotkov.co.uk/f/7/3/9/7392a8cd69b275fa1798ef94c839d2e082.png)
for every
![$y\in C_x$ $y\in C_x$](https://dxdy-04.korotkov.co.uk/f/3/a/4/3a4d2a90c5d2068686e1e6c2764f474e82.png)
. For each edge, we assign length equal the distance between its endpoints.
Notice that graph
![$G$ $G$](https://dxdy-02.korotkov.co.uk/f/5/2/0/5201385589993766eea584cd3aa6fa1382.png)
does not depend on a particular partition of
![$M$ $M$](https://dxdy-04.korotkov.co.uk/f/f/b/9/fb97d38bcc19230b0acd442e17db879c82.png)
into sets
![$A$ $A$](https://dxdy-02.korotkov.co.uk/f/5/3/d/53d147e7f3fe6e47ee05b88b166bd3f682.png)
and
![$B$ $B$](https://dxdy-03.korotkov.co.uk/f/6/1/e/61e84f854bc6258d4108d08d4c4a085282.png)
.
Let
![$e_1, e_2, \dots, e_m$ $e_1, e_2, \dots, e_m$](https://dxdy-03.korotkov.co.uk/f/a/9/9/a99804cb0e01867f14afbcd88ce7230482.png)
be a fixed ordering of the edges of
![$G$ $G$](https://dxdy-02.korotkov.co.uk/f/5/2/0/5201385589993766eea584cd3aa6fa1382.png)
such that the length of edges does not increase.
Now, define the potential function associated with partition
![$M=A\cup B$ $M=A\cup B$](https://dxdy-04.korotkov.co.uk/f/f/6/6/f66337b0825e62e33176cf65f41d541482.png)
as
![$$\sum_{k=1}^m 2^k \cdot c(e_k)$$ $$\sum_{k=1}^m 2^k \cdot c(e_k)$$](https://dxdy-02.korotkov.co.uk/f/9/e/a/9eae6cd90398c04b344f08fa5601fc5f82.png)
where the coefficient
![$c(e_k)=1$ $c(e_k)=1$](https://dxdy-01.korotkov.co.uk/f/8/4/1/841e1d296d8bebf30de92a63fbd350d582.png)
if the endpoints of edge
![$e_k$ $e_k$](https://dxdy-03.korotkov.co.uk/f/6/7/0/670e2f572d2d6a18251e96e79b69557c82.png)
are in distinct parts (i.e., one in
![$A$ $A$](https://dxdy-02.korotkov.co.uk/f/5/3/d/53d147e7f3fe6e47ee05b88b166bd3f682.png)
and the other in
![$B$ $B$](https://dxdy-03.korotkov.co.uk/f/6/1/e/61e84f854bc6258d4108d08d4c4a085282.png)
); otherwise
![$c(e_k)=0$ $c(e_k)=0$](https://dxdy-04.korotkov.co.uk/f/b/9/0/b9051a977d349b74924375f5f0f7873b82.png)
.
For example, suppose that
![$x\in A$ $x\in A$](https://dxdy-03.korotkov.co.uk/f/a/2/3/a23558f101650f4b374115e5bc51766482.png)
and
![$d_x^A > d_x^B$ $d_x^A > d_x^B$](https://dxdy-01.korotkov.co.uk/f/8/5/6/8564c8c1c7fa44e18edfc5f06c29f72e82.png)
so that we move
![$x$ $x$](https://dxdy-04.korotkov.co.uk/f/3/3/2/332cc365a4987aacce0ead01b8bdcc0b82.png)
from
![$A$ $A$](https://dxdy-02.korotkov.co.uk/f/5/3/d/53d147e7f3fe6e47ee05b88b166bd3f682.png)
to
![$B$ $B$](https://dxdy-03.korotkov.co.uk/f/6/1/e/61e84f854bc6258d4108d08d4c4a085282.png)
.
The inequality
![$d_x^A > d_x^B$ $d_x^A > d_x^B$](https://dxdy-01.korotkov.co.uk/f/8/5/6/8564c8c1c7fa44e18edfc5f06c29f72e82.png)
implies that
![$C_x \subset B$ $C_x \subset B$](https://dxdy-02.korotkov.co.uk/f/9/f/8/9f8b2265d215ff864bdf936a3a6fe13b82.png)
.
The potential here changes as follows:
(i) the coefficient of every edge
![$(x,y)$ $(x,y)$](https://dxdy-04.korotkov.co.uk/f/7/3/9/7392a8cd69b275fa1798ef94c839d2e082.png)
for
![$y\in C_x$ $y\in C_x$](https://dxdy-04.korotkov.co.uk/f/3/a/4/3a4d2a90c5d2068686e1e6c2764f474e82.png)
turns from 1 to 0 (there is at least one such edge);
(ii) the coefficients of edges
![$(x,z)$ $(x,z)$](https://dxdy-01.korotkov.co.uk/f/c/5/3/c530aa088731e71569c56291c4d2034f82.png)
(if they present in
![$G$ $G$](https://dxdy-02.korotkov.co.uk/f/5/2/0/5201385589993766eea584cd3aa6fa1382.png)
) for
![$z\in A$ $z\in A$](https://dxdy-01.korotkov.co.uk/f/c/6/9/c692e6ef6e07195bc9cf80cd8ecbc80782.png)
turn from 0 to 1.
However, the edges of type (i) are strictly shorter than the edges of type (ii) (since
![$z\not\in C_x$ $z\not\in C_x$](https://dxdy-01.korotkov.co.uk/f/0/e/3/0e3ed89d27b6d20071c9cdc7d183323282.png)
), and thus edges of type (i) have higher indices, making the potential decrease.