제출 #995517

#제출 시각아이디문제언어결과실행 시간메모리
995517Luca1234Foehn Phenomena (JOI17_foehn_phenomena)C++14
0 / 100
434 ms9924 KiB
#include <iostream> using namespace std; int v[200003], dif[200003]; int main() { int n, q, s, t, a, b, c; cin>>n>>q>>s>>t; long long temp=0; cin>>v[0]; for(int i=1; i<=n; i++) { cin>>v[i]; dif[i]=v[i]-v[i-1]; temp-=dif[i] *(dif[i]>0 ? s:t); } while(q--) { cin>>a>>b>>c; temp+=dif[a] *(dif[a]>0 ? s:t); dif[a]+=c; temp-=dif[a] *(dif[a]>0 ? s:t); if(b!=n) { temp+=dif[b+1] *(dif[b+1]>0 ? s:t); dif[b+1]-=c; temp-=dif[b+1] *(dif[b+1]>0 ? s:t); } cout<<temp<<'\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...