Best approach to resource allocation problem
Let us first show that your proposed greedy algorithm for the second restriction is not optimal.
For this, consider a scenario with $e_1 = 1, e_2 = 3$ and $e_3 = 4$ as well as $d_1 = 1, d_2 = 2$ and $d_3 = 3$.
The greedy algorithm would assign $d_1$ and $d_2$ to the first city and $d_3$ to the second one, leading to only one city being retaken.
However, if we assign $d_2$ to the first city and $d_1$ and $d_3$ to the second one we could retake both of them and hence, the greedy algorithm is not optimal.
As for algorithmic approaches, note that your problem given the second restriction (let's denote it by $L$) is $\mathsf{NP}$-complete which can be shown by reducing $\mathrm{Partition}$ to $L$:
For a $\mathrm{Partition}$ instance given by a multiset $S$ of integers define an $L$-instance where the multiset of the $d_i$s is given by $S$, i.e. for every element of $S$ we create a team of the same size.
Denote by $X$ the sum of the elements of $S$ and set $e_1 = e_2 = X/2 - 1$ as well as $e_i = X + 1$ for all $i &gt; 2$.
Now note that we can retake at most $2$ cities (as we don't have enough forces to retake any city which is held by at least $X$ soldiers) and we can only retake both of them if we can split our forces exactly in half, sending $X/2$ soldiers to the first and second city, respectively.
It follows that $S$ is a yes-instance of $\mathrm{Partition}$ if and only if we can retake 2 cities in our constructed $L$-instance (I left out some technical details but this reduction should work out just fine).
Assuming $\mathsf{P} \neq \mathsf{NP}$ this result implies that $L$ has no (deterministic) polynomial time algorithm. For some further lower bounds, see the other answer.