제출 #287017

#제출 시각아이디문제언어결과실행 시간메모리
287017MasterTasterFoehn Phenomena (JOI17_foehn_phenomena)C++14
0 / 100
1084 ms2884 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define pii pair<int, int> #define xx first #define yy second #define endl "\n" int n, q, s, t, arr[200010], temp; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n>>q>>s>>t; for (int i=0; i<=n; i++) cin>>arr[i]; while (q--) { int l, r, x; cin>>l>>r>>x; for (int i=l; i<=r; i++) arr[i]+=x; temp=0; for (int i=1; i<=n; i++) { if (arr[i]>arr[i-1]) { temp=temp-s*(arr[i]-arr[i-1]); } else temp=temp+t*(arr[i-1]-arr[i]); } cout<<temp<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...