QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#297220#5475. Make a LoopdoziccWA 0ms3560kbC++14564b2024-01-04 07:03:532024-01-04 07:03:53

Judging History

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

  • [2024-01-04 07:03:53]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3560kb
  • [2024-01-04 07:03:53]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int n, r[110], dp[1000010][2], sum;

int main()
{
    cin>>n;
    for(int i=1; i<=n; i++){cin>>r[i]; sum+=r[i];}
    if(n%2!=0){cout<<"NO\n"; return 0;}
    dp[0][0]=1;
    for(int i=1; i<=n; i++)
    {
        for(int j=sum/2-r[i]; j>=0; j--)
        {
            dp[j+r[i]][0]+=dp[j][1];
            dp[j+r[i]][1]+=dp[j][0];
        }
    }
    //for(int i=0; i<=sum/2; i++)cout<<dp[i][0]<<" "<<dp[i][1]<<endl;
    if(dp[sum/2][0]>=4)cout<<"YES\n";
    else cout<<"NO\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 1 1 1

output:

YES

result:

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