제출 #1116192

#제출 시각아이디문제언어결과실행 시간메모리
1116192staszic_ojuzFoehn Phenomena (JOI17_foehn_phenomena)C++17
40 / 100
188 ms12980 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main(){ ll wp; ll n, q, s, t; cin >> n >> q >> s >> t; ll wys[n+1]; wys[0] = 0; for(ll i = 0; i < n+1; i++){ cin >> wys[i]; } ll prze[q][3]; for (ll i = 0; i < q; i++){ cin >> prze[i][0] >> prze[i][1] >> prze[i][2]; } if(n <= 2000 && q <= 2000){ for(ll i = 0; i < q; i++){ for(ll k = prze[i][0]; k <= prze[i][1]; k++){ wys[k] += prze[i][2]; } wp = 0; for(ll j = 1; j < n+1; j++){ if(wys[j-1]-wys[j] > 0){ wp += (wys[j-1]-wys[j]) *t; } else{ wp += (wys[j-1]-wys[j])*s; } } cout << wp << "\n"; } } else{ for(ll i = 0; i < q; i++){ if(prze[i][1] == n){ wys[n] += prze[i][2]; } cout << wys[n]*(-1)*s << "\n"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...