제출 #287901

#제출 시각아이디문제언어결과실행 시간메모리
287901dolijanFoehn Phenomena (JOI17_foehn_phenomena)C++14
30 / 100
1087 ms1948 KiB
#include <bits/stdc++.h> typedef long long ll; #define pb push_back; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n,q,s,t; cin>>n>>q>>s>>t; 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 wind=0; for(int i=0;i<n;i++) { if(a[i]<a[i+1]) wind-=(s*(a[i+1]-a[i])); else wind+=((a[i]-a[i+1])*t); } cout<<wind<<endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...