Submission #1039834

#TimeUsernameProblemLanguageResultExecution timeMemory
1039834tamir1Foehn Phenomena (JOI17_foehn_phenomena)C++17
0 / 100
1044 ms1996 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; int n,q,s,t,i,j,l,r,v,tmp; ll a[200010]; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin >> n >> q >> s >> t; for(i=0;i<=n;i++) cin >> a[i]; for(j=1;j<=q;j++){ tmp=0; cin >> l >> r >> v; for(i=l;i<=r;i++) a[i]+=v; for(i=0;i<n;i++){ if(a[i]<a[i+1]) tmp-=(a[i+1]-a[i])*s; else tmp+=(a[i]-a[i+1])*t; } cout << tmp << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...