Submission #926528

#TimeUsernameProblemLanguageResultExecution timeMemory
926528SuPythonyFoehn Phenomena (JOI17_foehn_phenomena)C++17
30 / 100
1030 ms3764 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n,q,s,t; cin>>n>>q>>s>>t; vector<ll> a(n+1); for (int i=0; i<=n; i++) cin>>a[i]; while (q--) { ll l,r,x; cin>>l>>r>>x; for (int i=l; i<=r; i++) a[i]+=x; ll temp=0; for (int i=1; i<=n; i++) { ll d=a[i]-a[i-1]; if (d>0) temp-=s*d; else temp+=t*-d; } cout<<temp<<"\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...