QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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';
}
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'