Submission #51467

#TimeUsernameProblemLanguageResultExecution timeMemory
51467combi2k2Foehn Phenomena (JOI17_foehn_phenomena)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define int long long const int N = 2e5 + 1; int a[N], n, q, s, t; int f(int x) { if(x < 0) return x * s; return x * t; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> q >> s >> t; int ans = 0; for(int i = 0 ; i <= n ; ++i) { cin >> a[i]; if(i) { a[i - 1] = a[i - 1] - a[i]; ans += f(a[i - 1]); } } while(q--) { int l, r, x; cin >> l >> r >> x; if(l > 0) { ans -= f(a[l - 1]); a[l - 1] -= x; ans += f(a[l - 1]); } if(r < n) { ans -= f(a[r]); a[r] += x; ans += f(a[r]); } cout << ans << "\n"; } }

Compilation message (stderr)

foehn_phenomena.cpp:10:10: error: '::main' must return 'int'
 int main(){
          ^