QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#731913#4238. Zero SumTheZoneWA 0ms3676kbC++20617b2024-11-10 12:16:002024-11-10 12:16:01

Judging History

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

  • [2024-11-10 12:16:01]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3676kb
  • [2024-11-10 12:16:00]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;constexpr int N=35005,B=805;typedef long long ll;int n,id[N],a[N][7],k;ll dp[2][B*2+1];int main(){for(int i=1;i<=n;i++)
    for(int j=0;j<=2*k;j++) cin>>a[i][j];
    for(int i=1;i<=n;i++) id[i]=i;
    mt19937 rnd(time(0));
    shuffle(id+1,id+n+1,rnd);
    memset(dp,0x3f,sizeof dp);
    int b=B-5;
    dp[0][B]=0;
    for(int i=1;i<=n;i++){
        int p=i&1,q=p^1;
        memset(dp[p],0x3f,sizeof dp[p]);
    for(int j=-b;j<=b;j++){
        for(int l=-k;l<=k;l++)
            dp[p][j+B]=min(dp[p][j+B],dp[q][j-l+B]+a[id[i]][l+k]);}}cout<<dp[n&1][B]<<'\n';}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 1
3 14 15
-3 -5 -35
2 71 82

output:

0

result:

wrong answer 1st numbers differ - expected: '-19', found: '0'