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>
#define ll long long
using namespace std ;
signed main()
{
ios_base::sync_with_stdio( 0 ) ;
cin.tie( 0 ) ;
cout.tie( 0 ) ;
ll n, ans = 0 ;
cin >> n ;
ll a[n + 1] ;
for(ll i = 1 ; i <= n ; i++)
cin >> a[i] ;
for(ll i = 1 ; i <= n ; i++)
{
ll kol = 1, ls = 0, now = 0 ;
for(ll j = 1 ; j <= i ; j++)
ls += a[j] ;
for(ll j = i + 1 ; j <= n ; j++)
if(now < ls)
now += a[j] ;
else
{
ls = now ;
now = a[j] ;
kol++ ;
}
if(now >= ls)kol++ ;
ans = max(ans, kol) ;
}
cout << ans ;
return 0 ;
}
# | 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... |