# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
455335 | 2021-08-05T22:27:49 Z | qwerasdfzxcl | Bali Sculptures (APIO15_sculpture) | C++14 | 13 ms | 4300 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; int a[2020]; bool dp[2020][2020]; int main(){ int n, l, r; scanf("%d %d %d", &n, &l, &r); for (int i=1;i<=n;i++) scanf("%d", a+i); ll cur = 0, ans = 0; for (int i=60;i>=0;i--){ fill(dp[0], dp[2019]+2020, 0); cur |= 1LL<<i; ll cur2 = 0; for (int j=1;j<=n;j++){ cur2 += a[j]; if ((cur2&cur)==ans) dp[j][1] = 1; for (int k=2;k<=j;k++){ ll cur3 = 0; for (int l=j;l>k-1;l--){ cur3 += a[l]; if (dp[l-1][k-1] && (cur3&cur)==ans) dp[j][k] = 1; } } } bool flag = 1; for (int j=l;j<=r;j++) if (dp[n][j]) flag = 0; if (flag) ans |= 1LL<<i; } printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 4172 KB | Output is correct |
2 | Incorrect | 11 ms | 4172 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 4288 KB | Output is correct |
2 | Incorrect | 11 ms | 4172 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 4300 KB | Output is correct |
2 | Incorrect | 11 ms | 4264 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 4172 KB | Output is correct |
2 | Incorrect | 11 ms | 4288 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 4288 KB | Output is correct |
2 | Incorrect | 11 ms | 4288 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |