Submission #344531

#TimeUsernameProblemLanguageResultExecution timeMemory
344531tata666Bigger segments (IZhO19_segments)C++17
13 / 100
1588 ms492 KiB
#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second

using namespace std;

typedef long long llong;

const int MOD = 1e9 + 7;
const int MXN = 4e5 + 7;
const llong INF = 1e18 + 7;

int n, ans;
llong pref[MXN], a[MXN];

void make(int l, int r, int tl, int tr, int cnt){
  if(pref[r] - pref[l - 1] < pref[tr] - pref[tl - 1]){
    return;
  }
  if(r == n){
    ans = max(ans, cnt);
    return;
  }
  for(int j = r + 1; j <= n; j++){
    make(r + 1, j, l, r, cnt + 1);
  }
}

int main(){
  ios_base::sync_with_stdio(0);
  cin >> n;
  for(int i = 1; i <= n; i++){
    cin >> a[i];
    pref[i] = pref[i - 1] + a[i];
  }
  for(int i = 1; i <= n; i++){
    make(1, i, 1, 0, 1);
  }
  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...