Submission #1116138

#TimeUsernameProblemLanguageResultExecution timeMemory
1116138staszic_ojuzFoehn Phenomena (JOI17_foehn_phenomena)C++17
30 / 100
1064 ms2040 KiB
#include <iostream> #include <algorithm> #include <cmath> #include <queue> #include <vector> #include <stack> #include <unordered_map> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll n, q, s, t; cin >> n >> q >> s >> t; vector<ll> c(n + 1); for(int i = 0; i < n + 1; i++) { cin >> c[i]; } for(int i = 0; i < q; i++) { ll a, b, x; cin >> a >> b >> x; for(int i = a; i <= b;i++) { c[i] += x; } ll last = 0; for(int j = 1; j < n + 1; j++) { if(c[j] > c[j - 1]) { last = last + (c[j-1] - c[j]) * -1 * s; } else { last = last + (c[j] - c[j - 1]) * t; } } cout << -1 * last << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...