Submission #910953

#TimeUsernameProblemLanguageResultExecution timeMemory
910953daoquanglinh2007Bigger segments (IZhO19_segments)C++17
0 / 100
2 ms2396 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pii pair <int, int> #define fi first #define se second #define mp make_pair const int NM = 5e5; int N, a[NM+5], pref[NM+5], ans = 0; pii dp[NM+5]; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N; for (int i = 1; i <= N; i++) cin >> a[i]; int cur = 0, pre = 1; for (int i = 1; i <= N; i++){ cur += a[i]; if (cur >= pre){ ans++; pre = cur; cur = 0; } } if (cur > 0) ans++; 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...