# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
376278 | Halogen | Bigger segments (IZhO19_segments) | C++14 | 1 ms | 364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int N, presum[500005];
main() {
scanf("%lld", &N);
for (int i = 1; i <= N; i++) scanf("%lld", &presum[i]);
for (int i = 2; i <= N; i++) presum[i] += presum[i - 1];
int ans = 0, x = 0;
while (x < N) {
x = lower_bound(presum + 1, presum + N + 1, presum[x] + presum[x]) - presum;
ans++;
// printf("%lld\n", x);
}
if (x > N) ans--;
printf("%lld\n", ans);
}
Compilation message (stderr)
# | 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... |