Submission #746506

#TimeUsernameProblemLanguageResultExecution timeMemory
746506NeltFoehn Phenomena (JOI17_foehn_phenomena)C++17
30 / 100
1059 ms2744 KiB
#pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #define ll long long #define endl "\n" using namespace std; int a[200005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, q, l, r, x, i, s, t; cin >> n >> q >> s >> t; for (i = 0; i <= n; i++) cin >> a[i]; ll ans; while (q--) { cin >> l >> r >> x; for (; l <= r; l++) a[l] += x; // for (i = 0; i <= n; i++) // cout << a[i] << " \n"[i == n]; ans = 0; for (i = 0; i < n; i++) ans += (a[i] < a[i + 1] ? 1ll * (a[i] - a[i + 1]) * s : 1ll * (a[i] - a[i + 1]) * t);// cout << ans << " "; cout << ans << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...