QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#244827 | #5475. Make a Loop | IamZZ | WA | 0ms | 1516kb | C++14 | 648b | 2023-11-09 16:21:48 | 2023-11-09 16:21:48 |
Judging History
answer
#include<cstdio>
#define fre(x) freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);
using namespace std;
int t,n,r,s,f[2][2000001];
int main()
{
int i,j,k;
scanf("%d",&t);
while(t)
{
--t;
scanf("%d",&n);
s=0;
f[0][0]=1;
for(i=1;i<=n;++i)
{
scanf("%d",&r);
for(j=s;j>=0;--j)
{
for(k=0;k<2;++k)
{
f[k^1][j+r]=f[k^1][j+r]+f[k][j];
if(f[k^1][j+r]>4)
f[k^1][j+r]=4;
}
}
s=s+r;
}
if(s%2||n%2||f[0][s/2]!=4)
printf("No");
else
printf("Yes");
putchar(10);
for(i=0;i<=s;++i)
{
for(k=0;k<2;++k)
f[k][i]=0;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 1516kb
input:
4 1 1 1 1
output:
No No No No
result:
wrong answer 1st lines differ - expected: 'Yes', found: 'No'