Submission #757418

#TimeUsernameProblemLanguageResultExecution timeMemory
757418Trisanu_DasBali Sculptures (APIO15_sculpture)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { int n, s, e; cin >> n >> s >> e; int a[n + 1]; for(int i = 1; i < n + 1; i++) cin >> a[i]; int ans = (1LL << 41) - 1; int l[n + 1], R[n + 1]; l[0] = r[0] = 0; for(int k = 40; k > -1; k--) { ans ^= 1LL << k; for(int i = 1; i <= n; i++) { L[i] = INT_MAX, r[i] = INT_MIN; int s = 0; for(int j = i-1; j > -1; j--) { s += a[j + 1]; if((s & ans) == s) { l[i] = min(l[i], l[j] + 1); r[i] = max(r[i], r[j] + 1); } } } if(!(s <= r[n] && l[n] <= e)) ans ^= 1LL << k; } cout << ans << '\n'; }

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:11:9: error: 'r' was not declared in this scope
   11 |  l[0] = r[0] = 0;
      |         ^
sculpture.cpp:15:4: error: 'L' was not declared in this scope
   15 |    L[i] = INT_MAX, r[i] = INT_MIN;
      |    ^
sculpture.cpp:10:16: warning: unused variable 'R' [-Wunused-variable]
   10 |  int l[n + 1], R[n + 1];
      |                ^