QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#244827#5475. Make a LoopIamZZWA 0ms1516kbC++14648b2023-11-09 16:21:482023-11-09 16:21:48

Judging History

你现在查看的是最新测评结果

  • [2023-11-09 16:21:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1516kb
  • [2023-11-09 16:21:48]
  • 提交

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'