제출 #1158534

#제출 시각아이디문제언어결과실행 시간메모리
1158534achiFoehn Phenomena (JOI17_foehn_phenomena)C++20
100 / 100
188 ms5760 KiB
// runtime เกิน #include <bits/stdc++.h> using namespace std; int main () { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int N, Q, S, T; long long int L, R, X; long long int i, j; long long int deg = 0, prev = 0, curr; scanf("%lld %lld %lld %lld", &N, &Q, &S, &T); vector<long long int> diff(N+1); for (i = 0; i < N+1; i++) { scanf("%lld", &curr); diff[i] = prev - curr; prev = curr; if (diff[i] < 0) { deg += (diff[i])*S; } else { deg += (diff[i])*T; } } for (i = 0; i < Q; i++) { scanf("%lld %lld %lld", &L, &R, &X); if (L-1 >= 0) { if (diff[L] < 0) { deg -= (diff[L])*S; } else { deg -= (diff[L])*T; } diff[L] -= X; if (diff[L] < 0) { deg += (diff[L])*S; } else { deg += (diff[L])*T; } } if (R+1 <= N) { if (diff[R+1] < 0) { deg -= (diff[R+1])*S; } else { deg -= (diff[R+1])*T; } diff[R+1] += X; if (diff[R+1] < 0) { deg += (diff[R+1])*S; } else { deg += (diff[R+1])*T; } } cout << deg << endl; } return 0; }

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

foehn_phenomena.cpp: In function 'int main()':
foehn_phenomena.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf("%lld %lld %lld %lld", &N, &Q, &S, &T);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foehn_phenomena.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         scanf("%lld", &curr);
      |         ~~~~~^~~~~~~~~~~~~~~
foehn_phenomena.cpp:33:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         scanf("%lld %lld %lld", &L, &R, &X);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...