제출 #676211

#제출 시각아이디문제언어결과실행 시간메모리
676211mseebacherFoehn Phenomena (JOI17_foehn_phenomena)C++17
30 / 100
1092 ms1876 KiB
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef vector<int> vi; void solve(){ ll n,quer,s,t; cin >> n >> quer >> s >> t; ll 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...