#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n; 
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    
    int count = 0;
    ll threshold = 0;
    int pos = 0;
    
    while(pos < n){
        ll seg_sum = 0;
        if(count == 0){
            // For the first segment, simply take one element.
            seg_sum = a[pos++];
            threshold = seg_sum;
            count++;
        } else {
            // For subsequent segments, we need seg_sum >= threshold.
            while(pos < n && seg_sum < threshold){
                seg_sum += a[pos++];
            }
            if(seg_sum < threshold) break;  // Not enough sum to meet threshold.
            threshold = seg_sum;
            count++;
        }
    }
    
    cout << count;
    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... |