제출 #129308

#제출 시각아이디문제언어결과실행 시간메모리
129308taozai281Foehn Phenomena (JOI17_foehn_phenomena)C++17
0 / 100
698 ms4608 KiB
#include<bits/stdc++.h> using namespace std; int n,q,s,t; int a[200010]; int b[200010]; int l,r,x; int cal(int x){ if(x<0){ return x*s; } return x*t; } int main(){ scanf("%d%d%d%d",&n,&q,&s,&t); for(int i=0;i<=n;i++) { scanf("%d",&a[i]); } long long res=0; for(int i=1;i<=n;i++){ b[i]=a[i-1]-a[i]; res+=cal(b[i]); } while(q--){ scanf("%d%d%d",&l,&r,&x); res -= cal(b[l]); b[l] -= x; res += cal(b[l]); if (r < n) { res -= cal(b[r + 1]); b[r + 1] += x; res += cal(b[r + 1]); } cout<<res<<endl; } }

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

foehn_phenomena.cpp: In function 'int main()':
foehn_phenomena.cpp:14:7: 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:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&a[i]);
   ~~~~~^~~~~~~~~~~~
foehn_phenomena.cpp:27:12: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
       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...