比赛 2026.8.26 评测结果 TAAAAATTTT
题目名称 game 最终得分 50
用户昵称 ChenBp 运行时间 10.637 s
代码语言 C++ 内存使用 7.34 MiB
提交时间 2026-08-26 10:37:50
显示代码纯文本
#include <iostream>
#include <cstdio>
using namespace std;
using ll=long long;
const int N=5e5+5;
ll a[N],s[N];
int main(){
    freopen("gameemag.in","r",stdin);
    freopen("gameemag.out","w",stdout);
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        for(int i=1;i<=n;i++) {
            cin>>a[i];
            s[i]=s[i-1]+a[i];
        }
        int tot=n/2-1;
        ll a1=0,a2=0;
        for(int i=0;i<=tot;i++){
            ll now=s[i]+(s[n]-s[n-tot+i]);
            if(now>a2){
                a1=s[n]-now;
                a2=now;
            }
        }
        cout<<a1<<" "<<a2<<"\n";
    }
    return 0;
}