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 <iostream>
#include <deque>
using namespace std;
int main() {
int n; cin >> n;
int x = 0, ss = 0;
long long ls = 0, ns = 0;
deque<int> deq;
for(int i = 0; i < n; i++){
cin >> x, ns += x, deq.push_front(x);
if(ns >= ls){
++ss;
while(ns-2*deq.back() >= ls){
ns -= deq.back();
ls += deq.back();
deq.pop_back();
}
ls = ns, ns = 0;
deq.erase(deq.begin(),deq.end());
}
}
cout << ss;
}
# | 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... |