# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1057154 | 2024-08-13T14:35:20 Z | vjudge1 | Foehn Phenomena (JOI17_foehn_phenomena) | C++17 | 68 ms | 11604 KB |
#include <bits/stdc++.h> using namespace std; using i64 = long long; const int MAXN = 2e5 + 5; int N, Q; i64 S, T; i64 a[MAXN]; i64 ans = 0; i64 get(int p) { return a[p] > 0 ? -1LL * S * abs(a[p]) : 1LL * T * abs(a[p]); } void update(int p, int x) { if(p == 0 or p == N + 1) return; ans = ans - get(p); a[p] += x; ans = ans + get(p); } signed main() { #define TASK "code" if (fopen(TASK ".inp", "r")) { freopen(TASK ".inp", "r", stdin); freopen(TASK ".out", "w", stdout); } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N >> Q >> S >> T; for(int i = 0; i <= N; i++) cin >> a[i]; for(int i = N; i >= 1; i--) a[i] = a[i] - a[i - 1]; for(int i = 1; i <= N; i++) ans += get(i); while(Q--) { int l, r, x; cin >> l >> r >> x; update(l, x); update(r + 1, -x); cout << ans << "\n"; } return (0 ^ 0); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 476 KB | Output is correct |
15 | Correct | 1 ms | 344 KB | Output is correct |
16 | Correct | 1 ms | 344 KB | Output is correct |
17 | Correct | 1 ms | 344 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 0 ms | 456 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 60 ms | 8788 KB | Output is correct |
2 | Correct | 53 ms | 9424 KB | Output is correct |
3 | Correct | 54 ms | 10068 KB | Output is correct |
4 | Correct | 51 ms | 9300 KB | Output is correct |
5 | Correct | 53 ms | 10472 KB | Output is correct |
6 | Correct | 48 ms | 9552 KB | Output is correct |
7 | Correct | 47 ms | 9564 KB | Output is correct |
8 | Correct | 54 ms | 10316 KB | Output is correct |
9 | Correct | 56 ms | 10580 KB | Output is correct |
10 | Correct | 54 ms | 9296 KB | Output is correct |
11 | Correct | 47 ms | 9300 KB | Output is correct |
12 | Correct | 45 ms | 10064 KB | Output is correct |
13 | Correct | 61 ms | 10396 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 476 KB | Output is correct |
15 | Correct | 1 ms | 344 KB | Output is correct |
16 | Correct | 1 ms | 344 KB | Output is correct |
17 | Correct | 1 ms | 344 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 0 ms | 456 KB | Output is correct |
22 | Correct | 60 ms | 8788 KB | Output is correct |
23 | Correct | 53 ms | 9424 KB | Output is correct |
24 | Correct | 54 ms | 10068 KB | Output is correct |
25 | Correct | 51 ms | 9300 KB | Output is correct |
26 | Correct | 53 ms | 10472 KB | Output is correct |
27 | Correct | 48 ms | 9552 KB | Output is correct |
28 | Correct | 47 ms | 9564 KB | Output is correct |
29 | Correct | 54 ms | 10316 KB | Output is correct |
30 | Correct | 56 ms | 10580 KB | Output is correct |
31 | Correct | 54 ms | 9296 KB | Output is correct |
32 | Correct | 47 ms | 9300 KB | Output is correct |
33 | Correct | 45 ms | 10064 KB | Output is correct |
34 | Correct | 61 ms | 10396 KB | Output is correct |
35 | Correct | 53 ms | 8784 KB | Output is correct |
36 | Correct | 54 ms | 10340 KB | Output is correct |
37 | Correct | 56 ms | 11088 KB | Output is correct |
38 | Correct | 60 ms | 10832 KB | Output is correct |
39 | Correct | 56 ms | 10824 KB | Output is correct |
40 | Correct | 68 ms | 10960 KB | Output is correct |
41 | Correct | 57 ms | 10740 KB | Output is correct |
42 | Correct | 58 ms | 10836 KB | Output is correct |
43 | Correct | 54 ms | 10064 KB | Output is correct |
44 | Correct | 56 ms | 10580 KB | Output is correct |
45 | Correct | 52 ms | 10764 KB | Output is correct |
46 | Correct | 56 ms | 11604 KB | Output is correct |
47 | Correct | 47 ms | 10148 KB | Output is correct |
48 | Correct | 47 ms | 10180 KB | Output is correct |
49 | Correct | 50 ms | 9296 KB | Output is correct |
50 | Correct | 52 ms | 10068 KB | Output is correct |
51 | Correct | 55 ms | 10324 KB | Output is correct |
52 | Correct | 44 ms | 10140 KB | Output is correct |