제출 #398167

#제출 시각아이디문제언어결과실행 시간메모리
398167RifalFoehn Phenomena (JOI17_foehn_phenomena)C++14
30 / 100
1089 ms3532 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0); int n, q, s, t; cin >> n >> q >> s >> t; long long arr[n+1]; for(int i = 0; i < n+1; i++) { cin >> arr[i]; } while(q--) { long long temp = 0; long long l, r, x; cin >> l >> r >> x; for(int i = l; i <= r; i++) { arr[i] += x; } for(int i = 0; i < n; i++) { if(arr[i] < arr[i+1]) { temp -= s*(arr[i+1]-arr[i]); } else { temp += t*(arr[i]-arr[i+1]); } } cout << temp << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...