제출 #1158257

#제출 시각아이디문제언어결과실행 시간메모리
1158257achiFoehn Phenomena (JOI17_foehn_phenomena)C++20
30 / 100
1097 ms2240 KiB
#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; scanf("%lld %lld %lld %lld", &N, &Q, &S, &T); vector<long long int> altitiudes(N+1); for (i = 0; i < N+1; i++) { scanf("%lld", &altitiudes[i]); if (i == 0) continue; if (altitiudes[i-1] < altitiudes[i]) { deg += (altitiudes[i-1] - altitiudes[i])*S; } else { deg += (altitiudes[i-1] - altitiudes[i])*T; } } for (i = 0; i < Q; i++) { scanf("%lld %lld %lld", &L, &R, &X); if (L-1 >= 0) { if (altitiudes[L-1] < altitiudes[L]) { deg -= (altitiudes[L-1] - altitiudes[L])*S; } else { deg -= (altitiudes[L-1] - altitiudes[L])*T; } if (altitiudes[L-1] < (altitiudes[L] + X)) { deg += (altitiudes[L-1] - (altitiudes[L] + X))*S; } else { deg += (altitiudes[L-1] - (altitiudes[L] + X))*T; } } if (R+1 <= N) { if (altitiudes[R] < altitiudes[R+1]) { deg -= (altitiudes[R] - altitiudes[R+1])*S; } else { deg -= (altitiudes[R] - altitiudes[R+1])*T; } if ((altitiudes[R] + X) < altitiudes[R+1]) { deg += ((altitiudes[R] + X) - altitiudes[R+1])*S; } else { deg += ((altitiudes[R] + X) - altitiudes[R+1])*T; } } for (j = L; j <= R; j++) { altitiudes[j] += X; } cout << deg << endl; } return 0; }

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

foehn_phenomena.cpp: In function 'int main()':
foehn_phenomena.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%lld %lld %lld %lld", &N, &Q, &S, &T);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foehn_phenomena.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         scanf("%lld", &altitiudes[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
foehn_phenomena.cpp:30:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |         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...