| 比赛 |
2026.8.26 |
评测结果 |
TAAAAATTTT |
| 题目名称 |
game |
最终得分 |
50 |
| 用户昵称 |
2_16鸡扒拌面 |
运行时间 |
10.544 s |
| 代码语言 |
C++ |
内存使用 |
13.13 MiB |
| 提交时间 |
2026-08-26 11:25:58 |
显示代码纯文本
#include<bits/stdc++.h>
#define SNSNMO 500010
#define ll long long
using namespace std;
int t;
ll n,a[SNSNMO],b[SNSNMO],c[SNSNMO];
ll ans=0;
int main()
{
freopen("gameemag.in","r",stdin);
freopen("gameemag.out","w",stdout);
cin>>t;
while(t--)
{
ans=0;
memset(b,0,sizeof(b));
memset(c,0,sizeof(c));
cin>>n;
for(int i=1;i<=n;++i) cin>>a[i];
b[0]=c[n+1]=0;
for(int i=1;i<=n;++i) b[i]=b[i-1]+a[i];
for(int i=n;i>=1;--i) c[i]=c[i+1]+a[i];
for(int i=n/2-1,j=n+1;i>=0;--i,--j)
{
ans=max(ans,b[i]+c[j]);
}
cout<<c[1]-ans<<" "<<ans<<'\n';
}
return 0;
}