Submission #398169

#TimeUsernameProblemLanguageResultExecution timeMemory
398169birthdaycakeFoehn Phenomena (JOI17_foehn_phenomena)C++14
30 / 100
1093 ms1788 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; ll arr[200001]; ll ans[200001]; ll diff[200001]; int main(){ ll n,q,s,t; cin >> n >> q >> s >> t; n++; for(int i=0; i<n; i++){ cin >> arr[i]; } while(q--){ ll l,r,c; cin >> l >> r >> c; for(ll i=l; i<=r; i++){ arr[i]+=c; } ll cur = 0; for(ll i=1; i<n; i++){ ll diff = abs(arr[i]-arr[i-1]); if(arr[i]>arr[i-1]){ cur -= (diff*s); } else{ cur += (diff*t); } } cout << cur << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...