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;
typedef long long ll;
typedef tuple<ll,ll,ll> trio;
typedef pair<int,int> pii;
const int MAXN = 2e5+5;
const ll INF = 1e9;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define mk make_pair
#define pb push_back
#define fr first
#define sc second
int n, q, s, t;
ll a[MAXN];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> q >> s >> t;
for(int i = 0; i <= n; i++)
cin >> a[i];
while(q--) {
int L, R, X;
cin >> L >> R >> X;
if(R == n) a[n] += X;
if(a[n] < 0) cout << -a[n]*t << "\n";
else cout << -a[n]*s << "\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... |