Submission #655019

# Submission time Handle Problem Language Result Execution time Memory
655019 2022-11-02T16:37:35 Z onevoltman Stove (JOI18_stove) C++17
0 / 100
0 ms 212 KB
#include <bits/stdc++.h>

using namespace std;

#define MAXN 200200

typedef long long ll;

ll delta[MAXN], s, t, last, pos, neg;

int n, q;

void upd(int p, ll d){
	
	if(p<1 or p>n) return;
	
	if(delta[p]>0) pos-=delta[p];
	else neg+=delta[p];
	
	delta[p]+=d;
	
	if(delta[p]>0) pos+=delta[p];
	else neg-=delta[p];
}

int main(){
	
	cin >> n >> q >> s >> t;
	
	for(int i=0;i<=n;i++){
		
		cin >> delta[i];
		
		delta[i]-=last;
		
		if(delta[i]>0) pos+=delta[i];
		else neg-=delta[i];
		
		last+=delta[i];
	}
	
	for(int i=0;i<q;i++){
		
		int l, r;
		ll d;
		
		cin >> l >> r >> d;
		
		upd(l,d), upd(r+1,-d);
		
		cout << ll(neg*t-pos*s) << "\n";
	}
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -