제출 #1316407

#제출 시각아이디문제언어결과실행 시간메모리
1316407AgageldiFoehn Phenomena (JOI17_foehn_phenomena)C++20
30 / 100
1094 ms1996 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define N 500005 int tc = 1, n, a[N], Q, S, T; int32_t main() { ios::sync_with_stdio(0);cin.tie(0); cin >> n >> Q >> S >> T; for(int i = 0; i <= n; i++) { cin >> a[i]; } for(int i = 1; i <= Q; i++) { int u, v, c; cin >> u >> v >> c; for(int j = u; j <= v; j++) { a[j] += c; } int sm = 0, l = 0; for(int j = 0; j < n; j++) { if(a[j] < a[j + 1]) { sm -= S * abs(a[j + 1] - a[j]); } else sm += T * abs(a[j + 1] - a[j]); } cout << sm << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...