Submission #51504

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
515042018-06-18 04:37:16vovinamFoehn Phenomena (JOI17_foehn_phenomena)C++14
100 / 100
808 ms7576 KiB
#include<bits/stdc++.h>
#define int long long
using namespace std;
int res,a[200005],b[200005],s,t;
int trans(int a){
if(a<0){
return a*s;
}
return a*t;
}
signed main(){
int n,q;
cin>>n>>q>>s>>t;
for(int i=0;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<=n;i++){
b[i]=(a[i-1]-a[i]);
res+=trans(b[i]);
}
for(int i=1;i<=q;i++){
int l,r,x;
cin>>l>>r>>x;
if(l>0){
res-=trans(b[l]);
b[l]-=x;
res+=trans(b[l]);
}
if(r<n){
res-=trans(b[r+1]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...