제출 #1015764

#제출 시각아이디문제언어결과실행 시간메모리
1015764AliHasanliFoehn Phenomena (JOI17_foehn_phenomena)C++17
0 / 100
328 ms9300 KiB
#include<bits/stdc++.h> using namespace std; const int N=2e5+5,mod=1e9+7; int a[N],b[N],q,s,t,n,cur; void add(int i,int f){ if(i>n) return; if(b[i]>0) cur-=s*b[i]*f; else cur-=t*b[i]*f; } main(){ cin>>n>>q>>s>>t; for(int i=0;i<=n;i++){ cin >> a[i]; if(i)b[i]=a[i]-a[i-1]; add(i,1); } while(q--){ int l,r,x; cin>>l>>r>>x; add(l,-1); add(r+1,-1); b[l]+=x; b[r+1]-=x; add(l,1); add(r+1,1); cout<<cur<<endl; } }

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

foehn_phenomena.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...