Help me in solving PREFSUMMNMAX problem

My issue

how to apporach this question

My code

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--)
    {
       int n;
       cin>>n;
       vector<int>v(n,0);
       for(auto &it:v)
       cin>>it;
       
    }
    return 0;



}

Problem Link: Prefix Suffix Min Max Practice Coding Problem