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 = 0 ; i < n ; i++)
cin >> a[i] ;
if(n <= 20)
{
for(ll i = 0 ; i < (1 << n) ; i++)
{
bool flag = 0 ;
ll kol = 0, sum = 0, ls = 0 ;
for(ll j = 0 ; j < n ; j++)
{
sum += a[j] ;
if((1 << j) & i)
{
if(ls > sum)
{
flag = 1 ;
break ;
}
kol++ ;
ls = sum ;
sum = 0 ;
}
}
if(!flag)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... |