제출 #211464

#제출 시각아이디문제언어결과실행 시간메모리
211464jzhFoehn Phenomena (JOI17_foehn_phenomena)C++14
100 / 100
150 ms13176 KiB
#include <bits/stdc++.h> #pragma O3 using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll n,q,i,s,t,i1,x,y,w,sum=0,xi,yi,xf,yf,xii,yii; cin>>n>>q>>s>>t; ll arr[n+1]; for (i=0;i<=n;i++){ cin>>arr[i]; } ll diff[n+1]; diff[0]=0; for (i=1;i<=n;i++){ diff[i]=arr[i]-arr[i-1]; if (diff[i]>0){ sum-=diff[i]*s; } else { sum-=diff[i]*t; } } //cout<<sum<<'\n'; while (q--){ cin>>x>>y>>w; if (diff[x]>0)sum+=diff[x]*s; else sum+=diff[x]*t; if (y<n){ if (diff[y+1]>0)sum+=diff[y+1]*s; else sum+=diff[y+1]*t; } diff[x]+=w; diff[y+1]-=w; if (diff[x]>0){ sum-=diff[x]*s; } else { sum-=diff[x]*t; } if (y<n){ if (diff[y+1]>0){ sum-=diff[y+1]*s; } else { sum-=diff[y+1]*t; } } cout<<sum<<'\n'; } //cout<<sum<<'\n'; }

컴파일 시 표준 에러 (stderr) 메시지

foehn_phenomena.cpp:2:0: warning: ignoring #pragma O3  [-Wunknown-pragmas]
 #pragma O3
 
foehn_phenomena.cpp: In function 'int main()':
foehn_phenomena.cpp:8:18: warning: unused variable 'i1' [-Wunused-variable]
     ll n,q,i,s,t,i1,x,y,w,sum=0,xi,yi,xf,yf,xii,yii;
                  ^~
foehn_phenomena.cpp:8:33: warning: unused variable 'xi' [-Wunused-variable]
     ll n,q,i,s,t,i1,x,y,w,sum=0,xi,yi,xf,yf,xii,yii;
                                 ^~
foehn_phenomena.cpp:8:36: warning: unused variable 'yi' [-Wunused-variable]
     ll n,q,i,s,t,i1,x,y,w,sum=0,xi,yi,xf,yf,xii,yii;
                                    ^~
foehn_phenomena.cpp:8:39: warning: unused variable 'xf' [-Wunused-variable]
     ll n,q,i,s,t,i1,x,y,w,sum=0,xi,yi,xf,yf,xii,yii;
                                       ^~
foehn_phenomena.cpp:8:42: warning: unused variable 'yf' [-Wunused-variable]
     ll n,q,i,s,t,i1,x,y,w,sum=0,xi,yi,xf,yf,xii,yii;
                                          ^~
foehn_phenomena.cpp:8:45: warning: unused variable 'xii' [-Wunused-variable]
     ll n,q,i,s,t,i1,x,y,w,sum=0,xi,yi,xf,yf,xii,yii;
                                             ^~~
foehn_phenomena.cpp:8:49: warning: unused variable 'yii' [-Wunused-variable]
     ll n,q,i,s,t,i1,x,y,w,sum=0,xi,yi,xf,yf,xii,yii;
                                                 ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...