제출 #1096353

#제출 시각아이디문제언어결과실행 시간메모리
1096353YFHHFYFoehn Phenomena (JOI17_foehn_phenomena)C++14
0 / 100
76 ms3360 KiB
#include<bits/stdc++.h> #define tizoboz ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); // #define ll long long #define ld long double #define pb push_back #define int long long #define itn int #define ss set <int> #define prq priority_queue <int> #define endl '\n' #define md(x) (((x%MOD)+MOD)%MOD) #define vi vector <int> #define vl vector<ll> #define str string #define mp make_pair #define mata int32_t #define sz size #define lc id *2 #define rc lc +1 #define SZ(x) (int)x.size() #define mid (l+r)/2 #define cn cin #define ct cout #define sep " " #define F first #define X first #define S second #define Y second using namespace std; typedef pair <int , int> pii; long long n, q, s, t, temp = 0; vi a; inline void solve(int l, int r, int v){ long long ll = l - 1; long long rr = r; long long val = 0; if(ll >= 0){ if (a[ll] < 0){ val -= a[ll]*s; } else{ val -= a[ll]*t; } a[ll]-=v+1; if (a[ll] < 0){ val += a[ll]*s; } else{ val += a[ll]*t; } } if(rr<n){ if (a[rr] < 0){ val -= a[rr] * s; } else{ val -= a[rr] * t; } a[rr]+=v; if (a[rr] < 0){ val += a[rr]*s; } else{ val += a[rr]*t; } } temp += val; ct << temp << endl; return; } mata main(){ tizoboz; cn >> n >> q >> s >> t; long long yaa; cn >> yaa; for (int i = 1; i <= n; i++){ long long ma; cin >> ma ; long long num = yaa - ma; a.push_back(num); if (num < 0){ temp += num *s; } else{ temp += num * t; } yaa = ma; } for (int i = 0; i < q; i++){ int h, a, t; cn >> h >> a >> t; solve(h, a, t); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...