Submission #287021

#TimeUsernameProblemLanguageResultExecution timeMemory
287021MasterTasterFoehn Phenomena (JOI17_foehn_phenomena)C++14
30 / 100
1095 ms1920 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" ll 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--) { ll 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...