Submission #996830

#TimeUsernameProblemLanguageResultExecution timeMemory
996830toast12Foehn Phenomena (JOI17_foehn_phenomena)C++14
0 / 100
1037 ms3632 KiB
#include <bits/stdc++.h> using namespace std; int 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]; } vector<int> temp(n+1); while (q--) { int l, r, x; cin >> l >> r >> x; for (int i = l; i <= r; i++) { a[i] += x; } for (int i = 0; i < n; i++) { if (a[i] < a[i+1]) { temp[i+1] = temp[i]-(a[i+1]-a[i])*s; } else { temp[i+1] = temp[i]+(a[i]-a[i+1])*t; } } cout << temp[n] << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...