Submission #991036

#TimeUsernameProblemLanguageResultExecution timeMemory
991036horezusholFoehn Phenomena (JOI17_foehn_phenomena)C++14
30 / 100
1052 ms3676 KiB
#include<bits/stdc++.h> const char nl = '\n'; using namespace std; using ll = long long; const ll N = 2e5 + 10; ll n, q, s, t; ll a[N]; void solve() { cin >> n >> q >> s >> t; for (ll i = 0; i <= n; i ++) { cin >> a[i]; } while (q --) { ll l, r, x; cin >> l >> r >> x; for (ll i = l; i <= r; i ++) { a[i] += x; } ll wd = 0; for (ll i = 0; i < n; i ++) { if (a[i] < a[i+1]) { wd -= (a[i+1] - a[i]) * s; } else { wd += (a[i] - a[i+1]) * t; } } cout << wd << nl; } } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll tst = 1; // cin >> tst; while (tst --) { solve(); cout << nl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...