| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1159635 | Hakuna | Foehn Phenomena (JOI17_foehn_phenomena) | C++20 | 1095 ms | 2000 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, Q, S, T;
cin >> n >> Q >> S >> T;
long long a[n + 1];
for (int i = 0; i <= n; i++) {
cin >> a[i];
}
while (Q--) {
int l, r, x;
cin >> l >> r >> x;
long long res = 0;
for (int i = l; i <= r; i++) a[i] += x;
for (int i = 0; i < n; i++) {
if (a[i] < a[i + 1]) {
res -= S * (a[i + 1] - a[i]);
} else res += T * (a[i] - a[i + 1]);
}
cout << res << '\n';
}
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
