제출 #1046725

#제출 시각아이디문제언어결과실행 시간메모리
1046725DeathIsAweFoehn Phenomena (JOI17_foehn_phenomena)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define int long long ll segment[524288]; int main() { for (int i=0;i<524288;i++) { segment[i] = 0; } int n, q, s, t; cin >> n >> q >> s >> t; vector<int> altitudes(n + 1), diffs(n); for (int i=0;i<n+1;i++) { cin >> altitudes[i]; } ll ans = 0; for (int i=0;i<n;i++) { diffs[i] = altitudes[i+1] - altitudes[i]; if (diffs[i] < 0) { ans -= t * diffs[i]; } else { ans -= s * diffs[i]; } } int a, b, c; vector<ll> anslist; for (int i=0;i<q;i++) { cin >> a >> b >> c; if (diffs[a - 1] > 0) { diffs[a - 1] += c; ans -= s * c; if (diffs[a - 1] < 0) { ans -= (s + t) * diffs[a - 1]; } } else { diffs[a - 1] += c; ans -= t * c; if (diffs[a - 1] > 0) { ans -= (s - t) * diffs[a - 1]; } } if (b != n) { if (diffs[b] > 0) { diffs[b] -= c; ans += s * c; if (diffs[b] < 0) { ans += (s - t) * diffs[b]; } } else { diffs[b] -= c; ans += t * c; if (diffs[b] > 0) { ans += (-s + t) * diffs[a - 1]; } } } anslist.push_back(ans); } for (int i: anslist) { cout << i << '\n'; } }

컴파일 시 표준 에러 (stderr) 메시지

cc1plus: error: '::main' must return 'int'