| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 304557 | vipghn2003 | Foehn Phenomena (JOI17_foehn_phenomena) | C++14 | 129 ms | 13176 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=2e5+5;
int n,q,s,t,a[N],b[N],pos,neg;
void add(int x)
{
if(x>0) pos+=x;
else neg+=-x;
}
void del(int x)
{
if(x>0) pos-=x;
else neg-=-x;
}
main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin>>n>>q>>s>>t;
for(int i=0;i<=n;i++)
{
cin>>a[i];
if(i)
{
b[i]=a[i]-a[i-1];
add(b[i]);
}
}
while(q--)
{
int l,r,x;
cin>>l>>r>>x;
if(l>=1)
{
del(b[l]);
b[l]+=x;
add(b[l]);
}
if(r+1<=n)
{
del(b[r+1]);
b[r+1]-=x;
add(b[r+1]);
}
cout<<neg*t-pos*s<<'\n';
}
}
컴파일 시 표준 에러 (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... | ||||
