# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
58731 | leejseo | Foehn Phenomena (JOI17_foehn_phenomena) | C++98 | 1065 ms | 3740 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long lld;
int N, Q;
lld S, T, A[200001];
void input(){
scanf("%d%d%lld%lld", &N, &Q, &S, &T);
for (int i=0; i<=N; i++) scanf("%d", &A[i]);
}
void update(int l, int r, lld val){
for (int i=l; i<=r; i++) A[i] += val;
}
lld get_sum(){
lld ans = 0;
for (int i=1; i<=N; i++) ans += (A[i-1] < A[i] ? S*(A[i-1]-A[i]) : T*(A[i-1]-A[i]));
return ans;
}
int main(){
input();
int l, r;
lld val;
printf("\n");
while (Q--){
scanf("%d%d%lld", &l, &r, &val);
update(l, r, val);
printf("%lld\n", get_sum());
컴파일 시 표준 에러 (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... |