| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1166228 | GoBananas69 | Foehn Phenomena (JOI17_foehn_phenomena) | C++20 | 1097 ms | 2016 KiB |
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
typedef long long ll;
using namespace std;
signed main() {
cin.tie() -> sync_with_stdio(0);
ll n, q, s, t;
cin >> n >> q >> s >> t;
vector<ll> nums(n + 1);
for (ll i = 0; i<=n; ++i) {
cin >> nums[i];
}
while (q--) {
ll l, r, x;
cin >> l >> r >> x;
for (ll i = l; i<=r; ++i) {
nums[i] += x;
}
ll res = 0;
for (ll i = 1; i<=n; ++i) {
if (nums[i] > nums[i - 1]) {
res -= (nums[i] - nums[i - 1]) * s;
} else {
res += (nums[i - 1] - nums[i]) * t;
}
}
cout << res << '\n';
}
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
