QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#709524#5080. Folding StickOOBMABTRAMS#WA 0ms3648kbC++17362b2024-11-04 15:11:042024-11-04 15:11:05

Judging History

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

  • [2024-11-04 15:11:05]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3648kb
  • [2024-11-04 15:11:04]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=500013;
int a[N],b[N];
int n,dp[N];
int main(){
    int k=0;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i],b[i]=b[i-1]+a[i];
    for(int i=1;i<=n;i++) {
        while(b[i]-b[k+1]>=dp[k+1]&&k+1<i)k++;
        dp[i]=b[i]-b[k];
    }
    cout<<dp[n]<<'\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
3 2 2 3

output:

5

result:

wrong answer 1st lines differ - expected: '4', found: '5'