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 LL long long
int main() {
ios::sync_with_stdio(false), cin.tie(0);
int n, q;
cin >> n >> q;
vector<LL> a(n + 5), Q(q + 5);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= q; i++) {
cin >> Q[i];
}
vector<LL> l(q + 5), r(q + 5);
LL p = 0;
l[0] = r[0] = 0;
for (int i = 1; i <= q; i++) {
p += Q[i];
r[i] = max(r[i - 1], -p);
l[i] = max(l[i - 1], p);
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |