Submission #1116221

#TimeUsernameProblemLanguageResultExecution timeMemory
1116221staszic_ojuzFoehn Phenomena (JOI17_foehn_phenomena)C++17
0 / 100
1049 ms2016 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; 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; vector<ll> a(n+1); for (uint i = 0; i < n+1; i++) { cin >> a[i]; } for (uint i = 0; i < n; i++) { pr(lv(i) lv(a[i])) } while (q--) { uint l, r; ll x; cin >> l >> r >> x; ll total = 0; for (uint i = 1; i < n+1; i++) { if (i <= r && i >= l) { pr(lv(a[i]) lv(x)) a[i] += x; } pr(lv(i) lv(a[i])) total += val(a[i] - a[i-1], s , t); } cout << total << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...