Help me in solving GAME_XI problem

My issue

not passing all the test cases

My code

#include <bits/stdc++.h>

using namespace std;
void solve()
{
    int n, m;
    cin >> n >> m;
    vector < int > b(n);
    vector < int > bo(m);
    for (int i = 0; i < n; i++)
        cin >> b[i];
    for (int i = 0; i < m; i++)
        cin >> bo[i];
    if (n < 4 || m < 4 || (n + m) < 11) {
        cout << "-1";
        return;
    }
    long long sum = 0;
    int i = n - 1;
    int j = m - 1;
    for (int cnt = 0; cnt < 4; cnt++) {
        sum += b[i--];
        sum += bo[j--];
    }
    for (int cnt = 0; cnt < 3; cnt++)
    {
        if (j >= 0 && i >= 0)
        {
            if (b[i] >= bo[j])
            {
                sum += b[i--];
            }
            else {
                sum += bo[j--];
            }
        }
        else if(i>=0){
            sum+=b[i--];
        }
        else{
            sum+=bo[j--];
        }
    }
cout<<sum<<endl;
}

int main() {
    int t;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

please tell what am i doing wrong??
Learning course: Arrays, Strings & Sorting
Problem Link: GAME 11 Practice Coding Problem - CodeChef

You are asked to maximize the team’s skill, but you are only summing the last elements for some reason.

You need to find a way to maximize tha sum.