QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#301574#5475. Make a LoopwxhtzdyWA 1ms3756kbC++20409b2024-01-10 03:33:312024-01-10 03:33:31

Judging History

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

  • [2024-01-10 03:33:31]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3756kb
  • [2024-01-10 03:33:31]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

int n,x,dp[2][1000005];

int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n;
	dp[0][0]=1;
	int s=0;
	for(int i=1;i<=n;i++){
cin>>x;
		s+=x;
		for(int j=s/2;j>=x;j--){
			for(int f=0;f<2;f++){
				dp[f][j]=min(4,dp[f][j]+dp[f^1][j-x]);
			}
		}
	}
	if(n%2==0&&s%2==0&&dp[0][s/2]>=4) printf("Yes\n"); else printf("No\n");
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3756kb

input:

4
1 1 1 1

output:

No

result:

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