제출 #206229

#제출 시각아이디문제언어결과실행 시간메모리
206229opukittpceno_hhrFoehn Phenomena (JOI17_foehn_phenomena)C++17
30 / 100
1091 ms1784 KiB
#include <iostream> #include <vector> #include <map> #include <set> #include <queue> #include <algorithm> #include <string> #include <cmath> #include <cstdio> #include <iomanip> #include <fstream> #include <cassert> #include <cstring> #include <unordered_set> #include <unordered_map> #include <numeric> #include <ctime> #include <bitset> #include <complex> #include <random> using namespace std; #define int long long signed main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, q, s, t; cin >> n >> q >> s >> t; n++; vector<int> a(n); auto solve = [&]() { int ans = 0; for (int i = 0; i + 1 < n; i++) { if (a[i] <= a[i + 1]) ans += (a[i + 1] - a[i]) * s; else ans += (a[i + 1] - a[i]) * t; } return ans; }; for (auto &x : a) { cin >> x; } while (q--) { int l, r, x; cin >> l >> r >> x; for (int i = l; i <= r; i++) { a[i] += x; } cout << -solve() << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...