QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#301605#5475. Make a LoopwxhtzdyWA 0ms1536kbC++20506b2024-01-10 03:45:132024-01-10 03:45:13

Judging History

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

  • [2024-01-10 03:45:13]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1536kb
  • [2024-01-10 03:45:13]
  • 提交

answer

#include <stdio.h>

int min(int a, int b) { return a < b ? a : b; }

int n,x,s,a[100],dp[2][500005];

int main(){
scanf("%d",&n);
for(int i=0,s=0;i<n;i++) scanf("%d",a+i),s+=a[i];
	dp[0][0]=1;

	int ns=0;
	for(int i=1;i<=n;i++){
		ns+=a[i];
                 ns=min(ns,s/2);
		for(int j=ns;j>=a[i];j--){
			
				dp[0][j]=min(4,dp[0][j]+dp[1][j-x]);

				dp[1][j]=min(4,dp[1][j]+dp[0][j-x]);
		}
	}
	if(n%2==0&&s%2==0&&dp[0][s/2]>=4) printf("Yes\n"); else printf("No\n");
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 1536kb

input:

4
1 1 1 1

output:

No

result:

wrong answer 1st lines differ - expected: 'Yes', found: 'No'