이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
inline 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;
pr(lv(n) lv(q) lv(s) lv(t))
vector<ll> d(n);
ll total = 0, last;
cin >> last; // 0
pr(lv(last))
for (uint i = 0; i < n; i++) {
ll a;
cin >> a;
d[i] = a - last;
pr(lv(i) lv(a) lv(last) lv(d[i]))
last = a;
total += val(d[i], s, t);
}
pr(lv(n) lv(total) lv(s) lv(t))
while (q--) {
uint l, r;
ll x;
cin >> l >> r >> x;
pr(lv(l) lv(r) lv(x))
if (r < n) {
pr(ls("r") lv(r) lv(n) lv(total))
total -= val(d[r],s, t);
pr(lv(total))
d[r] -= x;
total += val(d[r],s, t);
pr(lv(total))
}
if (l > 0) {
pr(ls("l") lv(r) lv(n) lv(total))
total -= val(d[l-1], s, t);
pr(lv(total))
d[l-1] += x;
total += val(d[l-1], s, t);
pr(lv(total))
}
for (uint i = 0; i < n; i++) {
pr(lv(i) lv(d[i]))
}
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... |