Submission #996668

#TimeUsernameProblemLanguageResultExecution timeMemory
996668overwatch9Foehn Phenomena (JOI17_foehn_phenomena)C++17
30 / 100
1073 ms3420 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; using ll = long long; int main() { int N, Q; ll S, T; cin >> N >> Q >> S >> T; vector <ll> a(N+1); 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; ll ans = 0; for (int i = 0; i+1 <= N; i++) { if (a[i] < a[i+1]) ans -= S * (a[i+1] - a[i]); else ans += T * (a[i] - a[i+1]); } cout << ans << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...