Submission #211756

#TimeUsernameProblemLanguageResultExecution timeMemory
211756origami100Foehn Phenomena (JOI17_foehn_phenomena)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll n, q, s, t;
	cin >> n >> q >> s >> t;
	ll pre;
	cin >> pre;
	vector <ll> diff;
	ll pos = 0, neg = 0;
	for(ll i = 0; i < n; i++){
		ll a;
		cin >> a;
		diff.push_back(a - pre);
		if(a - pre < 0) neg += a - pre;
		else pos += a - pre;
		pre = a;
	}
	/*for(ll j = 0; j < diff.size(); j++){
		cout << diff[j] << ' ';
	}*/
	for(ll i = 0; i < q; i++){
		ll l, r, x;
		cin >> l >> r >> x;
		if(diff[l - 1] < 0){
			neg -= diff[l - 1];
		}else{
			pos -= diff[l - 1];
		}
		diff[l - 1] += x;
		if(diff[l - 1] < 0){
			neg += diff[l - 1];
		}else{
			pos += diff[l - 1];
		}
		if(r < n){
			if(diff[r] < 0){
				neg -= diff[r];
			}else{
				pos -= diff[r];
			}
			diff[r] -= x;
			if(diff[r] < 0){
				neg += diff[r];
			}else{
				pos += diff[r];
			}
		}
		/*for(ll j = 0; j < diff.size(); j++){
			cout << diff[j] << ' ';
		}
		cout << '\n';
		cout << pos << ' ' << neg << '\n';*/
		cout << 0 - ((pos * s) + (neg * t)) << '\n';
	}
}

Compilation message (stderr)

foehn_phenomena.cpp:4:9: error: '::main' must return 'int'
 ll main(){
         ^