Submission #162309

#TimeUsernameProblemLanguageResultExecution timeMemory
162309nvmdavaFoehn Phenomena (JOI17_foehn_phenomena)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; ll a[200005], s, t, T, x; int n, q, l, r; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>q>>s>>t; for(int i = 0; i <= n; i++) cin>>a[i]; for(int i = n; i > 0; i--){ a[i] -= a[i - 1]; T += (a[i] > 0 ? s : t) * -a[i]; } while(q--){ cin>>l>>r>>x; ++r; T -= (a[l] > 0 ? s : t) * -a[l]; a[l] += x; T += (a[l] > 0 ? s : t) * -a[l]; if(r <= n){ T -= (a[r] > 0 ? s : t) * -a[r]; a[r] -= x; T += (a[r] > 0 ? s : t) * -a[r]; } cout<<T<<'\n'; } }

Compilation message (stderr)

foehn_phenomena.cpp:4:1: error: 'll' does not name a type
 ll a[200005], s, t, T, x;
 ^~
foehn_phenomena.cpp: In function 'int main()':
foehn_phenomena.cpp:12:16: error: 's' was not declared in this scope
     cin>>n>>q>>s>>t;
                ^
foehn_phenomena.cpp:12:19: error: 't' was not declared in this scope
     cin>>n>>q>>s>>t;
                   ^
foehn_phenomena.cpp:14:12: error: 'a' was not declared in this scope
       cin>>a[i];
            ^
foehn_phenomena.cpp:16:6: error: 'a' was not declared in this scope
      a[i] -= a[i - 1];
      ^
foehn_phenomena.cpp:17:6: error: 'T' was not declared in this scope
      T += (a[i] > 0 ? s : t) * -a[i];
      ^
foehn_phenomena.cpp:22:17: error: 'x' was not declared in this scope
      cin>>l>>r>>x;
                 ^
foehn_phenomena.cpp:24:6: error: 'T' was not declared in this scope
      T -= (a[l] > 0 ? s : t) * -a[l];
      ^
foehn_phenomena.cpp:24:12: error: 'a' was not declared in this scope
      T -= (a[l] > 0 ? s : t) * -a[l];
            ^