Submission #918612

# Submission time Handle Problem Language Result Execution time Memory
918612 2024-01-30T07:36:39 Z vjudge1 Foehn Phenomena (JOI17_foehn_phenomena) C++17
0 / 100
409 ms 10320 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ld long double
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define elif else if
#define x first
#define y second
ll n, q, s, t, l, r, k, a[200005], d[200005], ans;


int main(){
    cin >> n >> q >> s >> t;
    for(int i=0; i<=n; i++){
        cin >> a[i];
    }
    d[0]=a[0];
    for(int i=1; i<=n; i++){
        d[i]=a[i]-a[i-1];
        ans-=d[i]*((d[i]<0)?t:s);
    }
    cout << ans << endl;
    for(int i=1; i<=q; i++){
        cin >> l >> r >> k;
        ans+=d[l]*((d[l]<0)?t:s);
        d[l]+=k;
        ans-=d[l]*((d[l]<0)?t:s);
        if(r<n){
            ans+=d[r+1]*((d[r+1]<0)?t:s);
            d[r+1]-=k;
            ans-=d[r+1]*((d[r+1]<0)?t:s);
        }
        cout << ans << endl;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 409 ms 10320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -