제출 #124780

#제출 시각아이디문제언어결과실행 시간메모리
124780aintaFoehn Phenomena (JOI17_foehn_phenomena)C++17
100 / 100
170 ms12408 KiB
#include<cstdio> #include<algorithm> using namespace std; int n, Q, S, T, A[201000]; long long w[201000], res; long long Calc(long long a) { if (a > 0)return -S * a; return -T * a; } int main() { int i, b, e, x; scanf("%d%d%d%d", &n, &Q, &S, &T); for (i = 0; i <= n; i++) { scanf("%d", &A[i]); if (i) { w[i] = A[i] - A[i - 1]; res += Calc(w[i]); } } while (Q--) { scanf("%d%d%d", &b, &e, &x); res -= Calc(w[b]); w[b] += x; res += Calc(w[b]); if (e < n) { res -= Calc(w[e + 1]); w[e + 1] -= x; res += Calc(w[e + 1]); } printf("%lld\n", res); } }

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

foehn_phenomena.cpp: In function 'int main()':
foehn_phenomena.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d%d", &n, &Q, &S, &T);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
foehn_phenomena.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &A[i]);
         ~~~~~^~~~~~~~~~~~~
foehn_phenomena.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d", &b, &e, &x);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...