제출 #1160364

#제출 시각아이디문제언어결과실행 시간메모리
1160364uropeltidaeBigger segments (IZhO19_segments)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h> #define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define int long long #define st first #define nd second #define pb push_back #define love our_kolhoz #define watch(x) (cout << #x << " == " << x << '\n') ///azyraq oila using namespace std; const int N = 2e5 + 10, inf = 1e18, mod = 1e9 + 7, block = 350; const double eps = 1e-6; //qol batyr int a[N]; int n; int ans(int i, int p) { if (i == n) { return (a[i] >= p); } int sum = 0, kek = 0; for (int j = i; j < n; j++) { sum += a[j]; if (sum >= p) { kek = max(kek, ans(i + 1, sum)); } } return kek + 1; } void solve() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } int kek = 0, sum = 0; for (int i = 1; i < n; i++ ) { sum += a[i]; kek = max(kek, ans(i + 1, sum)); //cout << ans(i + 1, sum) << '\n'; } cout << kek + 1; } signed main() { speed; //freopen("248.in", "r", stdin); //freopen("248.out", "w", stdout); int _t = 1; //cin >> _t; while (_t--) { solve(); } return 0; } // salem // there's really no way of winning // if in their eyes you'll always be a dumb blonde... ///meow meow
#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...