Submission #782583

#TimeUsernameProblemLanguageResultExecution timeMemory
782583ZHIRDILBILDIZBigger segments (IZhO19_segments)C++14
13 / 100
20 ms324 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...