제출 #676210

#제출 시각아이디문제언어결과실행 시간메모리
676210mseebacherFoehn Phenomena (JOI17_foehn_phenomena)C++17
0 / 100
1069 ms2748 KiB
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef vector<int> vi; void solve(){ int n,quer,s,t; cin >> n >> quer >> s >> t; int b[n+1]; for(int i = 0;i<=n;i++) cin >> b[i]; ll ant = 0; for(int i = 0;i<quer;i++){ int l,r,x; cin >> l >> r >> x; for(int j = l;j<=r;j++){ b[j]+=x; } ant = 0; for(int j = 1;j<=n;j++){ if(b[j-1] >= b[j]) ant+=(t*abs(b[j-1]-b[j])); else ant -= (s*abs(b[j-1]-b[j])); } cout << ant << "\n"; } } int main(){ ios::sync_with_stdio(0); cin.tie(nullptr); cout << fixed << setprecision(8); int t = 1; // cin >> t; while(t){ solve(); t--; cout << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...