| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 204162 | mdn2002 | Foehn Phenomena (JOI17_foehn_phenomena) | C++14 | 1091 ms | 2872 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const long long mod=998244353;
long long n,q,s,t,ps[200005],a[200005],ans,sqt;
vector<pair<int,pair<int,int> > >v;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
cin>>n>>q>>s>>t;
sqt=ceil(sqrt(q));
long long b;
cin>>b;
for(int i=1;i<=n;i++)
{
cin>>a[i];
long long aa=a[i];
long long dif=b-aa;
if(dif>=0)ans+=dif*t;
else ans+=dif*s;
b=aa;
}
int l,r;
long long x,dif=0;
while(q--)
{
cin>>l>>r>>x;
long long la=a[l],ra=a[r],oa=a[l-1],va=a[r+1];
for(int i=0;i<v.size();i++)
{
long long ll=v[i].first,rr=v[i].second.first,xx=v[i].second.second;
if(ll<=l&&l<=rr)la+=xx;
if(ll<=r&&r<=rr)ra+=xx;
if(ll<=l-1&&l-1<=rr)oa+=xx;
if(ll<=r+1&&r+1<=rr)va+=xx;
}
v.push_back({l,{r,x}});
long long ll=la+x,rr=ra+x;
if(l>0)
{
dif=oa-la;
if(dif>=0)ans-=dif*t;
else ans-=dif*s;
dif=oa-ll;
if(dif>=0)ans+=dif*t;
else ans+=dif*s;
}
if(r<n)
{
dif=ra-va;
if(dif>=0)ans-=dif*t;
else ans-=dif*s;
dif=rr-va;
if(dif>=0)ans+=dif*t;
else ans+=dif*s;
}
cout<<ans<<endl;
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
