QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#398872 | #8057. Best Carry Player 4 | njupt_zy# | WA | 56ms | 3588kb | C++17 | 1.1kb | 2024-04-25 19:23:03 | 2024-04-25 19:23:10 |
Judging History
answer
#include<cstdio>
#include<algorithm>
using namespace std;
long long a[500001],b[500001];
int main()
{
int t,ti;
//freopen("input.in","r",stdin);
scanf("%d",&t);
for (ti=1;ti<=t;++ti)
{
int m,i,j;
long long l1=0,l2=0;
scanf("%d",&m);
for (i=0;i<m;++i)
{
scanf("%lld",&a[i]);
l1+=a[i];
}
for (i=0;i<m;++i)
{
scanf("%lld",&b[i]);
l2+=b[i];
}
if (l1<l2) a[0]+=(l2-l1);
else if (l1>l2) b[0]+=(l1-l2);
long long ans=0;
for (i=1;i<=m-1;++i)
{
if (not (min(a[i],b[m-i])>=1)) continue;
a[i]-=1,b[m-i]-=1;
long long s1=1;
for (j=0;j<=m-1;++j)
s1+=min(a[j],b[m-1-j]);
ans=max(ans,s1);
a[i]+=1,b[m-i]+=1;
}
printf("%lld\n",ans);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3588kb
input:
5 2 1 2 3 4 3 1 0 1 0 1 0 4 1 0 0 1 1 1 1 1 5 123456 114514 1919810 233333 234567 20050815 998244353 0 0 0 10 5 3 5 3 2 4 2 4 1 5 9 9 8 2 4 4 3 5 3 0
output:
5 1 2 467900 29
result:
ok 5 number(s): "5 1 2 467900 29"
Test #2:
score: -100
Wrong Answer
time: 56ms
memory: 3576kb
input:
100000 5 0 1 1 1 1 0 0 1 0 0 5 0 0 0 0 0 1 1 1 0 0 5 0 0 2 1 1 0 2 1 0 1 5 0 0 0 0 0 1 2 1 0 0 5 0 1 0 1 1 0 0 1 1 1 5 2 0 0 0 1 1 0 0 0 3 5 2 0 0 1 1 0 2 1 1 1 5 0 0 0 0 2 0 0 0 0 1 5 0 0 0 0 0 0 1 1 0 0 5 4 0 0 0 0 0 0 0 1 0 5 0 0 0 0 1 2 1 1 0 0 5 0 2 3 0 0 0 0 0 1 0 5 1 1 1 0 1 1 0 1 0 1 5 0 0 0...
output:
2 0 3 0 2 0 3 0 0 0 1 1 3 0 2 0 0 0 0 0 0 0 4 0 4 0 0 1 2 2 0 4 0 0 1 0 0 1 1 0 0 3 4 3 2 1 2 0 1 0 0 1 0 0 0 1 0 1 0 1 0 4 0 0 0 2 0 3 2 0 1 0 0 0 0 1 1 2 0 0 4 0 1 2 0 2 1 0 0 0 3 2 3 0 1 0 4 3 3 0 0 2 0 1 3 1 1 0 0 0 0 0 2 2 0 0 0 0 1 0 1 0 0 0 3 1 0 0 2 0 2 0 2 0 0 0 3 0 3 1 0 2 0 3 0 1 2 0 0 1 ...
result:
wrong answer 3rd numbers differ - expected: '4', found: '3'