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 n;
vector<int> vec;
int main() {
cin.tie(0) -> sync_with_stdio(0);
cin >> n;
vec.resize(n);
for(int &e:vec) cin >> e;
int cans = 1;
for(int i=1;i<min(50, n);i++) {
long long cur = 0;
long long sum;
int idx = i;
for(int j=0;j<i;j++) cur += vec[j];
int curcnt = 1;
while(idx < n) {
sum = 0;
while(idx < n && sum < cur) sum += vec[idx++];
if(sum >= cur) curcnt++;
cur = sum;
}
cans = max(cans, curcnt);
}
cout << cans;
}
# | 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... |