제출 #1116207

#제출 시각아이디문제언어결과실행 시간메모리
1116207staszic_ojuzFoehn Phenomena (JOI17_foehn_phenomena)C++17
0 / 100
60 ms3656 KiB
#include<bits/stdc++.h> #ifdef _DEBUG #define ls(x) << x << ", " #define lv(x) << #x << ": " << flush << x << ", " #define pr(x) cout << "Line: " << __LINE__ << ", " x << endl; #else #define ls(x) #define lv(x) #define pr(x) ; #endif using namespace std; typedef unsigned int uint; typedef unsigned long long ull; typedef long long ll; inline ll val(ll x, ll s, ll t) { return x * (x < 0 ? s : t); } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); uint n, q; ll s, t; cin >> n >> q >> s >> t; pr(lv(n) lv(q) lv(s) lv(t)) vector<ll> d(n); ll total = 0, last; cin >> last; // 0 pr(lv(last)) for (uint i = 0; i < n; i++) { ll a; cin >> a; d[i] = a - last; pr(lv(i) lv(a) lv(last) lv(d[i])) last = a; total += val(d[i], s, t); } pr(lv(n) lv(total) lv(s) lv(t)) while (q--) { uint l, r; ll x; cin >> l >> r >> x; pr(lv(l) lv(r) lv(x)) if (r < n) { pr(ls("r") lv(r) lv(n) lv(total)) total -= val(d[r],s, t); pr(lv(total)) d[r] -= x; total += val(d[r],s, t); pr(lv(total)) } if (l > 0) { pr(ls("l") lv(r) lv(n) lv(total)) total -= val(d[l-1], s, t); pr(lv(total)) d[l-1] += x; total += val(d[l-1], s, t); pr(lv(total)) } for (uint i = 0; i < n; i++) { pr(lv(i) lv(d[i])) } cout << total << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...