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>
#ifdef _DEBUG
#define ls(x) << x << ", "
#define lv(x) << #x << ": " << flush << x << ", "
#define pr(x) cout << "Line: " << __LINE__ << ", " x << endl;
#else
#define ls(x)
#define lv(x)
#define pr(x) ;
#endif
using namespace std;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long ll;
ll val(ll x, ll s, ll t) {
return x * (x < 0 ? s : t);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
uint n, q;
ll s, t;
cin >> n >> q >> s >> t;
vector<ll> a(n+1);
for (uint i = 0; i < n+1; i++) {
cin >> a[i];
}
for (uint i = 0; i < n; i++) {
pr(lv(i) lv(a[i]))
}
while (q--) {
uint l, r;
ll x;
cin >> l >> r >> x;
ll total = 0;
for (uint i = 1; i < n+1; i++) {
if (i <= r && i >= l) {
pr(lv(a[i]) lv(x))
a[i] += x;
}
pr(lv(i) lv(a[i]))
total += val(a[i] - a[i-1], s , t);
}
cout << total << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |