# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
51501 | 2018-06-18T04:34:05 Z | vovinam | Foehn Phenomena (JOI17_foehn_phenomena) | C++14 | 288 ms | 14872 KB |
#include<bits/stdc++.h> 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; scanf("%d%d%d",&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]); b[r+1]+=x; res+=trans(b[r+1]); } printf("%I64d\n",res); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 376 KB | Output is correct |
2 | Incorrect | 5 ms | 488 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 253 ms | 14872 KB | Output is correct |
2 | Correct | 288 ms | 14872 KB | Output is correct |
3 | Incorrect | 285 ms | 14872 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 376 KB | Output is correct |
2 | Incorrect | 5 ms | 488 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |