#include <bits/stdc++.h>
using namespace std;
int n,i,j;
long long mas[3001],sum[3001];
pair <int,long long> dp[3001];
int main() {
cin>>n;
for (i=1;i<=n;i++) {
cin>>mas[i];
sum[i]=sum[i-1]+mas[i];
}
for (i=1;i<=n;i++)
for (j=0;j<i;j++)
//if ((-dp[j].second)<=(sum[i]-sum[j]))
dp[i]=max(dp[i],{dp[j].first+1,sum[j]-sum[i]});
cout<<dp[n].first<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |