제출 #537080

#제출 시각아이디문제언어결과실행 시간메모리
537080qwerasdfzxclFoehn Phenomena (JOI17_foehn_phenomena)C++14
100 / 100
169 ms11468 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll d[200200]; int main(){ int n, q, s, t; scanf("%d %d %d %d", &n, &q, &s, &t); int prv; ll ans = 0; scanf("%d", &prv); for (int i=1;i<=n;i++){ scanf("%lld", d+i); ll tmp = d[i]; d[i] -= prv; prv = tmp; ans -= d[i] * (d[i]>0?s:t); } while(q--){ int l, r, x; scanf("%d %d %d", &l, &r, &x); ans += d[l] * (d[l]>0?s:t); if (r<n) ans += d[r+1] * (d[r+1]>0?s:t); d[l] += x; if (r<n) d[r+1] -= x; ans -= d[l] * (d[l]>0?s:t); if (r<n) ans -= d[r+1] * (d[r+1]>0?s:t); printf("%lld\n", ans); } return 0; }

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

foehn_phenomena.cpp: In function 'int main()':
foehn_phenomena.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d %d %d %d", &n, &q, &s, &t);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foehn_phenomena.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d", &prv);
      |     ~~~~~^~~~~~~~~~~~
foehn_phenomena.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%lld", d+i);
      |         ~~~~~^~~~~~~~~~~~~
foehn_phenomena.cpp:26:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |         scanf("%d %d %d", &l, &r, &x);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...