제출 #907560

#제출 시각아이디문제언어결과실행 시간메모리
907560androFoehn Phenomena (JOI17_foehn_phenomena)C++14
30 / 100
1053 ms3676 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, q, s, t; cin >> n >> q >> s >> t; vector<int> a(n + 1); for(int i = 0; i <= n; i++) { cin >> a[i]; } while(q--) { int l, r, x; cin >> l >> r >> x; for(int i = l; i <= r; i++) { a[i] += x; } int u = 0; for(int i = 0; i < n; i++) { if(a[i] < a[i + 1]) { u -= s * (a[i + 1] - a[i]); } else { u += t * (a[i] - a[i + 1]); } } cout << u << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...