제출 #54401

#제출 시각아이디문제언어결과실행 시간메모리
54401bogdan10bosFoehn Phenomena (JOI17_foehn_phenomena)C++14
100 / 100
260 ms168976 KiB
#include <bits/stdc++.h> using namespace std; //#define FILE_IO typedef long long LL; int N, Q, S, T; int v[200005]; LL s[200005]; int main() { #ifdef FILE_IO freopen("1.in", "r", stdin); freopen("1.out", "w", stdout); #endif scanf("%d%d", &N, &Q); scanf("%d%d", &S, &T); for(int i = 0; i <= N; i++) scanf("%d", &v[i]); LL ans = 0LL; for(int i = 1; i <= N; i++) { s[i] = v[i - 1] - v[i]; ans += s[i] * (s[i] >= 0 ? T : S); } for(int i = 1; i <= Q; i++) { int st, dr, x; scanf("%d%d%d", &st, &dr, &x); if(st != 0) { ans -= s[st] * (s[st] > 0 ? T : S); s[st] -= x; ans += s[st] * (s[st] > 0 ? T : S); } if(dr != N) { dr++; ans -= s[dr] * (s[dr] > 0 ? T : S); s[dr] += x; ans += s[dr] * (s[dr] > 0 ? T : S); } printf("%lld\n", ans); } return 0; }

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

foehn_phenomena.cpp: In function 'int main()':
foehn_phenomena.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &N, &Q);
     ~~~~~^~~~~~~~~~~~~~~~
foehn_phenomena.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &S, &T);
     ~~~~~^~~~~~~~~~~~~~~~
foehn_phenomena.cpp:23:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 0; i <= N; i++) scanf("%d", &v[i]);
                                 ~~~~~^~~~~~~~~~~~~
foehn_phenomena.cpp:33:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d", &st, &dr, &x);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...