제출 #658696

#제출 시각아이디문제언어결과실행 시간메모리
658696blueFoehn Phenomena (JOI17_foehn_phenomena)C++17
100 / 100
277 ms7404 KiB
#include <iostream> #include <vector> using namespace std; int main() { long long N, Q, S, T; cin >> N >> Q >> S >> T; long long a, b; long long D[N+1]; long long w = 0; cin >> b; for(long long i = 1; i <= N; i++) { a = b; cin >> b; D[i] = b-a; w += -D[i] * (D[i] > 0 ? S:T); } long long l, r, u; vector<long long> res; for(long long i = 1; i <= Q; i++) { cin >> l >> r >> u; w -= -D[l] * (D[l] > 0 ? S:T); D[l] += u; w += -D[l] * (D[l] > 0 ? S:T); if(r != N) { w -= -D[r+1] * (D[r+1] > 0 ? S:T); D[r+1] -= u; w += -D[r+1] * (D[r+1] > 0 ? S:T); } long long q = 0; res.push_back(w); } for(long long y:res) cout << y << '\n'; return 0; }

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

foehn_phenomena.cpp: In function 'int main()':
foehn_phenomena.cpp:36:19: warning: unused variable 'q' [-Wunused-variable]
   36 |         long long q = 0;
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...