Submission #151248

#TimeUsernameProblemLanguageResultExecution timeMemory
151248theboatmanBigger segments (IZhO19_segments)C++17
0 / 100
3 ms504 KiB
#include <bits/stdc++.h> #define y1 theboatman #define make_struct(args...) {args} using namespace std; typedef long long ll; const long long INF = 1e18 + 10; const int inf = 1e9 + 10; const int N = 1e6 + 10; int main() { cin.tie(0); ios::sync_with_stdio(0); int n; cin >> n; vector <int> a(n); for(int i = 0; i < n; i++) { cin >> a[i]; } int ans = 0; for(int i = 0; i < n; i++) { int res = 1; long long last = 0; for(int j = 0; j <= i; j++) { last += a[j]; } long long sum = 0; for(int j = i + 1; j < n; j++) { sum += a[j]; if (sum >= last) { last = sum; sum = 0; res++; } } if (sum) { res--; } ans = max(ans, res); } cout << ans << "\n"; 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...