제출 #20915

#제출 시각아이디문제언어결과실행 시간메모리
20915gs14004Foehn Phenomena (JOI17_foehn_phenomena)C++11
100 / 100
209 ms3580 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pi; typedef long long lint; int n, q, s, t; lint a[200005], ans; void upd(int x, int v){ if(a[x] < 0) ans -= a[x] * t; else ans -= a[x] * s; a[x] += v; if(a[x] < 0) ans += a[x] * t; else ans += a[x] * s; } int main(){ scanf("%d %d %d %d %*d",&n,&q,&s,&t); int prv = 0; for(int i=1; i<=n; i++){ int x; scanf("%d",&x); upd(i, x - prv); prv = x; } while(q--){ int s, e, x; scanf("%d %d %d",&s,&e,&x); upd(s, x); if(e < n) upd(e+1, -x); printf("%lld\n", -ans); } }

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

foehn_phenomena.cpp: In function 'int main()':
foehn_phenomena.cpp:18:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d %d %*d",&n,&q,&s,&t);
                                      ^
foehn_phenomena.cpp:22:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&x);
                 ^
foehn_phenomena.cpp:28:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d",&s,&e,&x);
                             ^

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...