QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#709524 | #5080. Folding Stick | OOBMABTRAMS# | WA | 0ms | 3648kb | C++17 | 362b | 2024-11-04 15:11:04 | 2024-11-04 15:11:05 |
Judging History
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';
}
详细
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'