# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
58785 | leejseo | Foehn Phenomena (JOI17_foehn_phenomena) | C++98 | 277 ms | 144660 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;
typedef long long lld;
const int MAXN = 200001;
lld A[MAXN+2], S, T, ans;
int N, Q, L[MAXN+1];
inline lld sum_val(lld x) {return x > 0 ? -S*x : -T*x;}
void input(){
scanf("%d%d%lld%lld", &N, &Q, &S, &T);
for (int i=0; i<=N; i++) scanf("%d", &L[i]);
for (int i=1; i<=N; i++){
A[i] = L[i] - L[i-1];
ans += sum_val(A[i]);
}
}
int main(){
input();
int u, v;
lld w;
while (Q--){
scanf("%d%d%lld", &u, &v, &w);
ans -= sum_val(A[u]);
A[u] += w;
ans += sum_val(A[u]);
if (v != N){
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... |