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;
int main()
{
int n, mx = 0;
cin >> n;
vector<long long>v(n);
for(int i = 0;i < n;++i)cin >> v[i];
for(int i = 1;i < (1 << n);i += 2){
long long temp = 0;
vector<long long>S;
for(int j = 0;j < n;++j){
if(i & (1 << j)){
temp += v[j];
}
else{
S.push_back(temp);
temp = v[j];
}
}
S.push_back(temp);
bool check = 1;
int sz = S.size();
for(int j = 1;j < sz && check;++j){
if(S[j - 1] > S[j])check = 0;
}
if(check){
mx = max(mx, sz);
}
}
cout << mx;
}
# | 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... |