QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#301581 | #5475. Make a Loop | wxhtzdy | WA | 0ms | 1592kb | C++20 | 406b | 2024-01-10 03:37:38 | 2024-01-10 03:37:38 |
Judging History
answer
#include <stdio.h>
int min(int a, int b) { return a < b ? a : b; }
int n,x,dp[2][1000005];
int main(){
scanf("%d",&n);
dp[0][0]=1;
int s=0;
for(int i=1;i<=n;i++){
scanf("%d",&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: 0ms
memory: 1592kb
input:
4 1 1 1 1
output:
No
result:
wrong answer 1st lines differ - expected: 'Yes', found: 'No'