Submission #754061

#TimeUsernameProblemLanguageResultExecution timeMemory
754061vjudge1Foehn Phenomena (JOI17_foehn_phenomena)C++17
0 / 100
1071 ms3520 KiB
#include <bits/stdc++.h> #define ll long long; using namespace std; int main(){ long long n,q,s,t,hasil; cin>>n>>q>>s>>t; long long a[n], b[n]; long long l,r,x,naik,turun; for(int i=0; i<=n; i++){ cin>>a[i]; b[i]=a[i]; } for(int z=0; z<q; z++){ cin>>l>>r>>x; for(int c=l; c<=r; c++){ a[c] += x; } hasil = 0; naik = 0; turun = 0; for(int y=0; y<n; y++){ if(a[y]>a[y+1]){ turun += a[y]-a[y+1]; } if(a[y]<a[y+1]){ naik += a[y+1]-a[y]; } } naik = naik * s; turun = turun * t; hasil = turun-naik; cout<<hasil<<endl; } return 0; }

Compilation message (stderr)

foehn_phenomena.cpp: In function 'int main()':
foehn_phenomena.cpp:11:21: warning: variable 'b' set but not used [-Wunused-but-set-variable]
   11 |     long long a[n], b[n];
      |                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...