These three problems are almost the same.
CF618F [Double Knapsack]: https://mirror.codeforces.com/problemset/problem/618/F
CF1836E [Twin Cluster]: https://mirror.codeforces.com/contest/1836/problem/E
Beijing College Entrance Exam:
Given two positive integer arrays $$$A$$$ and $$$B$$$, such that:
$$$len(A) = len(B) = n$$$
and
for $$$\every 1 \leq i \leq n$$$, $$$1 \leq a_i, b_i \leq n$$$.