Submission #58733

#TimeUsernameProblemLanguageResultExecution timeMemory
58733leejseoFoehn Phenomena (JOI17_foehn_phenomena)C++98
30 / 100
1088 ms3040 KiB
#include <bits/stdc++.h> using namespace std; typedef long long lld; int N, Q; lld S, T, A[200001]; void input(){ scanf("%d%d%lld%lld", &N, &Q, &S, &T); for (int i=0; i<=N; i++) scanf("%lld", &A[i]); } void update(int l, int r, lld val){ for (int i=l; i<=r; i++) A[i] += val; } lld get_sum(){ lld ans = 0; for (int i=1; i<=N; i++) ans += (A[i-1] < A[i] ? S*(A[i-1]-A[i]) : T*(A[i-1]-A[i])); return ans; } int main(){ input(); int l, r; lld val; while (Q--){ scanf("%d%d%lld", &l, &r, &val); update(l, r, val); printf("%lld\n", get_sum()); } }

Compilation message (stderr)

foehn_phenomena.cpp: In function 'void input()':
foehn_phenomena.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%lld%lld", &N, &Q, &S, &T);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foehn_phenomena.cpp:9:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for (int i=0; i<=N; i++) scanf("%lld", &A[i]);
                              ~~~~~^~~~~~~~~~~~~~~
foehn_phenomena.cpp: In function 'int main()':
foehn_phenomena.cpp:27:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%lld", &l, &r, &val);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...