Submission #1118090

#TimeUsernameProblemLanguageResultExecution timeMemory
1118090vjudge1Foehn Phenomena (JOI17_foehn_phenomena)C++14
0 / 100
84 ms8688 KiB
#include <bits/stdc++.h> #define sts(v) stable_sort(v.BE, v.E) #define Rsts(v) stable_sort(v.rBE, v.rE) #define rev(v) reverse(v.BE, v.E) #define BE begin() #define rBE rbegin() #define E end() #define rE rend() #define pb push_back #define ppb pop_back() #define pf push_front #define ppf pop_front() #define F first #define S second using namespace std; using ll = long long; struct datos{ int val, w, k; }; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, Q, S, T; cin >> n >> Q >> S >> T; vector<int> v(n + 1); for(int i = 0; i <= n; i++) cin >> v[i]; while(Q--){ int l, r, x; cin >> l >> r >> x; if(S == T){ if(r == n)v[n] += x; cout << -(v[n] * S) << '\n'; }else{ while(l <= r){ v[l] += x; l++; } ll Temp[n + 1]; Temp[0] = 0; for(int i = 1; i <= n; i++){ Temp[i] = Temp[i - 1]; if(v[i] > v[i - 1]) Temp[i] -= S * (v[i] - v[i - 1]); else Temp[i] += T * (v[i - 1] - v[i]); } cout << Temp[n] << '\n'; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...