Submission #1017665

#TimeUsernameProblemLanguageResultExecution timeMemory
1017665vjudge1Foehn Phenomena (JOI17_foehn_phenomena)C++17
30 / 100
1079 ms2000 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second using namespace std; signed main() { int n, q, s, t; cin >> n >> q >> s >> t; vector <int> a(n + 1); for(int i =0 ; i <= n; i++) { cin >> a[i]; } while (q--) { int l, r, x; cin >> l >> r >> x; int ans = 0; for(int i = 1; i <= n; i++) { if(i >= l && i <= r) { a[i] += x; } if (a[i - 1] < a[i]) { ans -= (a[i] - a[i-1]) * s; } else { ans += (a[i-1] - a[i]) * t; } } cout << ans << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...