# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
885899 | dimashhh | Bigger segments (IZhO19_segments) | C++17 | 1525 ms | 2180 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1,MOD = 998244353;
typedef long long ll;
int n,a[N];
ll dp[N],mn[N];
void test(){
cin >> n;
for(int i = 1;i <= n;i++){
cin >> a[i];
}
for(int i = 1;i <=n;i++){
ll cur = 0;
for(int j = i;j >= 1;j--){
cur += a[j];
if(mn[j - 1] <= cur){
if(dp[j - 1] + 1 > dp[i]){
dp[i] = dp[j - 1] +1;
mn[i] = cur;
}
}
}
}
cout << dp[n];
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int T = 1;
// cin >> T;
test();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |