Submission #68203

#TimeUsernameProblemLanguageResultExecution timeMemory
68203almasalmasFoehn Phenomena (JOI17_foehn_phenomena)C++17
30 / 100
46 ms4080 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int a[100001]; main () { int n, q, s, t; cin >> n >> q >> s >> t; for (int i = 0;i <= n;i ++) cin >> a[i]; while (q --) { int l, r, x; cin >> l >> r >> x; for (int i = l;i <= r;i ++) a[i] += x; int cur = 0; for (int i = 1;i <= n;i ++) { int len = abs (a[i] - a[i - 1]); if (a[i] > a[i - 1]) { cur -= len * s; } else cur += len * t; } cout << cur << endl; } return 0; }

Compilation message (stderr)

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