# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
26930 | kajebiii | Foehn Phenomena (JOI17_foehn_phenomena) | C++14 | 226 ms | 5144 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, int> pli;
typedef tuple<int, int, int> ti;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;
const int MAX_N = 2e5 + 100;
int N, S, T, Q;
ll Nr[MAX_N], Diff[MAX_N];
ll getV(ll d) {
if(d > 0) return -S * d;
return T * -d;
}
int main() {
cin >> N >> Q >> S >> T;
for(int i=0; i<=N; i++) scanf("%lld", &Nr[i]);
for(int i=0; i<N; i++) Diff[i] = Nr[i+1] - Nr[i];
ll ans = 0;
for(int i=0; i<N; i++) ans += getV(Diff[i]);
while(Q--) {
int x, y, t; scanf("%d%d%d", &x, &y, &t);
ans -= getV(Diff[x-1]); ans += getV(Diff[x-1] += t);
if(y == N) {printf("%lld\n", ans); continue;}
ans -= getV(Diff[y]); ans += getV(Diff[y] -= t);
printf("%lld\n", ans);
}
return 0;
}
컴파일 시 표준 에러 (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... |