QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#226028#6422. Evil CoordinatekokomiisbestWA 3ms96656kbC++14846b2023-10-25 14:49:462023-10-25 14:49:47

Judging History

This is the latest submission verdict.

  • [2023-10-25 14:49:47]
  • Judged
  • Verdict: WA
  • Time: 3ms
  • Memory: 96656kb
  • [2023-10-25 14:49:46]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10,K=100+19;
int f[N][K][2];
int w[N];
int n,k;
int main(){
    cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>w[i];
    memset(f,-0x3f,sizeof f);
    f[0][0][0]=0;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=k;j++){
            // f[i][j][0]=f[i-1][j][0];
            // //\xc2\xf4\xb3\xf6
            // if(j) f[i][j][0]=max(f[i][j][0],f[i-1][j-1][1]+w[i]);
            // //\xc2\xf2\xc8\xeb
            // f[i][j][1]=max(f[i-1][j][1],f[i-1][j][0]-w[i]);
            //\xbf\xc9\xd2\xd4\xd3ù\xf6\xb6\xaf\xca\xfd\xd7\xe9\xd3Ż\xaf
            f[i&1][j][0]=f[(i-1)&1][j][0];
            if(j) f[i&1][j][0]=max(f[i&1][j][0],f[(i-1)&1][j-1][1]+w[i]);
            f[i&1][j][1]=max(f[(i-1)&1][j][1],f[(i-1)&1][j][0]-w[i]);
        }
    }
    int res=0;
    for(int i=0;i<=k;i++) res=max(res,f[n&1][i][0]);
    cout<<res;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 96656kb

input:

5
1 1
RURULLD
0 5
UUU
0 3
UUU
0 2
UUU
0 0
UUU

output:

0

result:

wrong answer Line "0" doesn't correspond to pattern "[UDLR]{1,100000}|Impossible"