Submission #1126292

#TimeUsernameProblemLanguageResultExecution timeMemory
1126292heeyFoehn Phenomena (JOI17_foehn_phenomena)C++20
0 / 100
1093 ms1224 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5+2; int n, q, s, t; int a[maxn]; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> q >> s >> t; for(int i = 0; i <= n; i++) cin >> a[i]; while(q--){ int l, r, x; cin >> l >> r >> x; for(int i = l; i <= r; i++){ a[i] += x; } int ans = 0; for(int i = 1; i <= n; i++){ if(a[i] > a[i-1]) ans -= s * (a[i] - a[i-1]); else ans += t * (a[i-1] - a[i]); } cout << ans << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...