#include <bits/stdc++.h>
#define forinc(i,a,b) for(int i = a, _key = b; i <= _key; ++i)
#define fordec(i,a,b) for(int i = a, _key = b; i >= _key; --i)
#define fori(i,n) for(int i = 0, _key = n; i < _key; ++i)
#define ford(i,n) for(int i = n - 1; i >= 0; --i)
#define forvct(i,v) for(int i = 0, _key = v.size(); i < _key; ++i)
#define sqr(x) ((ll)x) * (x)
#define task "sculpture"
#define st first
#define nd second
#define m_p make_pair
#define m_t make_tuple
#define p_b push_back
#define p_f push_front
#define pp_b pop_back
#define pp_f pop_front
#define sn string::npos
#define heap priority_queue
#define ll long long
#define db double
#define str string
#define eps 1e-10
#define nn 2010
using namespace std;
const ll oo = 1000000000000007LL;
ll n, A, B, a[nn], s[nn], res;
bool f[nn][nn];
bool comp(const ll x, const ll y)
{
return (x | y) == x;
}
bool check(const int &t)
{
ll x = res >> t;
memset(f,false,sizeof f);
forinc(i,1,n)
{
f[i][1] = comp(x,s[i]>>t);
forinc(j,2,min((ll)i,B))
{
f[i][j] = false;
forinc(ii,j-1,i-1)
if (f[ii][j-1] && comp(x,(s[i]-s[ii])>>t))
{
f[i][j] = true;
break;
}
}
}
forinc(i,A,B)
if (f[n][i]) return true;
return false;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
//srand(time(NULL));
//freopen(task".inp","r",stdin);
//freopen(task".out","w",stdout);
cin >> n >> A >> B;
forinc(i,1,n)
{
cin >> a[i];
s[i] = s[i-1] + a[i];
}
res = 0;
ford(i,60)
if (!check(i)) res |= (1 << i);
cout << res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
6156 KB |
Output is correct |
2 |
Correct |
13 ms |
6156 KB |
Output is correct |
3 |
Correct |
13 ms |
6156 KB |
Output is correct |
4 |
Correct |
9 ms |
6156 KB |
Output is correct |
5 |
Correct |
9 ms |
6156 KB |
Output is correct |
6 |
Correct |
13 ms |
6156 KB |
Output is correct |
7 |
Correct |
9 ms |
6156 KB |
Output is correct |
8 |
Correct |
13 ms |
6156 KB |
Output is correct |
9 |
Correct |
9 ms |
6156 KB |
Output is correct |
10 |
Correct |
9 ms |
6156 KB |
Output is correct |
11 |
Correct |
13 ms |
6156 KB |
Output is correct |
12 |
Correct |
13 ms |
6156 KB |
Output is correct |
13 |
Correct |
13 ms |
6156 KB |
Output is correct |
14 |
Correct |
13 ms |
6156 KB |
Output is correct |
15 |
Correct |
9 ms |
6156 KB |
Output is correct |
16 |
Correct |
13 ms |
6156 KB |
Output is correct |
17 |
Correct |
13 ms |
6156 KB |
Output is correct |
18 |
Correct |
13 ms |
6156 KB |
Output is correct |
19 |
Correct |
13 ms |
6156 KB |
Output is correct |
20 |
Correct |
13 ms |
6156 KB |
Output is correct |
21 |
Correct |
13 ms |
6156 KB |
Output is correct |
22 |
Correct |
13 ms |
6156 KB |
Output is correct |
23 |
Correct |
13 ms |
6156 KB |
Output is correct |
24 |
Correct |
9 ms |
6156 KB |
Output is correct |
25 |
Correct |
13 ms |
6156 KB |
Output is correct |
26 |
Correct |
9 ms |
6156 KB |
Output is correct |
27 |
Correct |
13 ms |
6156 KB |
Output is correct |
28 |
Correct |
13 ms |
6156 KB |
Output is correct |
29 |
Correct |
13 ms |
6156 KB |
Output is correct |
30 |
Incorrect |
13 ms |
6156 KB |
Output isn't correct |
31 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
6156 KB |
Output is correct |
2 |
Correct |
9 ms |
6156 KB |
Output is correct |
3 |
Correct |
9 ms |
6156 KB |
Output is correct |
4 |
Correct |
13 ms |
6156 KB |
Output is correct |
5 |
Correct |
13 ms |
6156 KB |
Output is correct |
6 |
Correct |
13 ms |
6156 KB |
Output is correct |
7 |
Correct |
9 ms |
6156 KB |
Output is correct |
8 |
Correct |
9 ms |
6156 KB |
Output is correct |
9 |
Correct |
13 ms |
6156 KB |
Output is correct |
10 |
Correct |
13 ms |
6156 KB |
Output is correct |
11 |
Correct |
9 ms |
6156 KB |
Output is correct |
12 |
Correct |
16 ms |
6156 KB |
Output is correct |
13 |
Correct |
13 ms |
6156 KB |
Output is correct |
14 |
Correct |
9 ms |
6156 KB |
Output is correct |
15 |
Correct |
13 ms |
6156 KB |
Output is correct |
16 |
Correct |
16 ms |
6156 KB |
Output is correct |
17 |
Correct |
9 ms |
6156 KB |
Output is correct |
18 |
Correct |
13 ms |
6156 KB |
Output is correct |
19 |
Correct |
13 ms |
6156 KB |
Output is correct |
20 |
Correct |
9 ms |
6156 KB |
Output is correct |
21 |
Correct |
16 ms |
6156 KB |
Output is correct |
22 |
Correct |
13 ms |
6156 KB |
Output is correct |
23 |
Correct |
13 ms |
6156 KB |
Output is correct |
24 |
Correct |
13 ms |
6156 KB |
Output is correct |
25 |
Correct |
13 ms |
6156 KB |
Output is correct |
26 |
Correct |
13 ms |
6156 KB |
Output is correct |
27 |
Correct |
13 ms |
6156 KB |
Output is correct |
28 |
Correct |
13 ms |
6156 KB |
Output is correct |
29 |
Correct |
9 ms |
6156 KB |
Output is correct |
30 |
Correct |
9 ms |
6156 KB |
Output is correct |
31 |
Correct |
9 ms |
6156 KB |
Output is correct |
32 |
Correct |
13 ms |
6156 KB |
Output is correct |
33 |
Correct |
13 ms |
6156 KB |
Output is correct |
34 |
Correct |
13 ms |
6156 KB |
Output is correct |
35 |
Correct |
13 ms |
6156 KB |
Output is correct |
36 |
Correct |
9 ms |
6156 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
6156 KB |
Output is correct |
2 |
Correct |
16 ms |
6156 KB |
Output is correct |
3 |
Correct |
9 ms |
6156 KB |
Output is correct |
4 |
Correct |
13 ms |
6156 KB |
Output is correct |
5 |
Correct |
13 ms |
6156 KB |
Output is correct |
6 |
Correct |
9 ms |
6156 KB |
Output is correct |
7 |
Correct |
13 ms |
6156 KB |
Output is correct |
8 |
Correct |
13 ms |
6156 KB |
Output is correct |
9 |
Correct |
13 ms |
6156 KB |
Output is correct |
10 |
Correct |
9 ms |
6156 KB |
Output is correct |
11 |
Correct |
13 ms |
6156 KB |
Output is correct |
12 |
Correct |
13 ms |
6156 KB |
Output is correct |
13 |
Correct |
13 ms |
6156 KB |
Output is correct |
14 |
Correct |
13 ms |
6156 KB |
Output is correct |
15 |
Correct |
13 ms |
6156 KB |
Output is correct |
16 |
Correct |
13 ms |
6156 KB |
Output is correct |
17 |
Correct |
9 ms |
6156 KB |
Output is correct |
18 |
Correct |
13 ms |
6156 KB |
Output is correct |
19 |
Correct |
13 ms |
6156 KB |
Output is correct |
20 |
Correct |
9 ms |
6156 KB |
Output is correct |
21 |
Correct |
13 ms |
6156 KB |
Output is correct |
22 |
Correct |
13 ms |
6156 KB |
Output is correct |
23 |
Correct |
9 ms |
6156 KB |
Output is correct |
24 |
Correct |
13 ms |
6156 KB |
Output is correct |
25 |
Correct |
13 ms |
6156 KB |
Output is correct |
26 |
Correct |
13 ms |
6156 KB |
Output is correct |
27 |
Correct |
16 ms |
6156 KB |
Output is correct |
28 |
Correct |
16 ms |
6156 KB |
Output is correct |
29 |
Correct |
16 ms |
6156 KB |
Output is correct |
30 |
Correct |
13 ms |
6156 KB |
Output is correct |
31 |
Correct |
16 ms |
6156 KB |
Output is correct |
32 |
Correct |
13 ms |
6156 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
6156 KB |
Output is correct |
2 |
Correct |
9 ms |
6156 KB |
Output is correct |
3 |
Correct |
9 ms |
6156 KB |
Output is correct |
4 |
Correct |
9 ms |
6156 KB |
Output is correct |
5 |
Correct |
9 ms |
6156 KB |
Output is correct |
6 |
Correct |
13 ms |
6156 KB |
Output is correct |
7 |
Correct |
13 ms |
6156 KB |
Output is correct |
8 |
Correct |
13 ms |
6156 KB |
Output is correct |
9 |
Correct |
13 ms |
6156 KB |
Output is correct |
10 |
Correct |
13 ms |
6156 KB |
Output is correct |
11 |
Correct |
13 ms |
6156 KB |
Output is correct |
12 |
Correct |
9 ms |
6156 KB |
Output is correct |
13 |
Correct |
13 ms |
6156 KB |
Output is correct |
14 |
Correct |
9 ms |
6156 KB |
Output is correct |
15 |
Correct |
9 ms |
6156 KB |
Output is correct |
16 |
Correct |
13 ms |
6156 KB |
Output is correct |
17 |
Correct |
13 ms |
6156 KB |
Output is correct |
18 |
Correct |
13 ms |
6156 KB |
Output is correct |
19 |
Correct |
13 ms |
6156 KB |
Output is correct |
20 |
Correct |
9 ms |
6156 KB |
Output is correct |
21 |
Correct |
13 ms |
6156 KB |
Output is correct |
22 |
Correct |
13 ms |
6156 KB |
Output is correct |
23 |
Correct |
13 ms |
6156 KB |
Output is correct |
24 |
Correct |
13 ms |
6156 KB |
Output is correct |
25 |
Correct |
9 ms |
6156 KB |
Output is correct |
26 |
Correct |
16 ms |
6156 KB |
Output is correct |
27 |
Correct |
16 ms |
6156 KB |
Output is correct |
28 |
Correct |
13 ms |
6156 KB |
Output is correct |
29 |
Correct |
13 ms |
6156 KB |
Output is correct |
30 |
Incorrect |
13 ms |
6156 KB |
Output isn't correct |
31 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
6156 KB |
Output is correct |
2 |
Correct |
13 ms |
6156 KB |
Output is correct |
3 |
Correct |
13 ms |
6156 KB |
Output is correct |
4 |
Correct |
13 ms |
6156 KB |
Output is correct |
5 |
Correct |
13 ms |
6156 KB |
Output is correct |
6 |
Correct |
13 ms |
6156 KB |
Output is correct |
7 |
Correct |
13 ms |
6156 KB |
Output is correct |
8 |
Correct |
13 ms |
6156 KB |
Output is correct |
9 |
Correct |
9 ms |
6156 KB |
Output is correct |
10 |
Correct |
13 ms |
6156 KB |
Output is correct |
11 |
Correct |
9 ms |
6156 KB |
Output is correct |
12 |
Correct |
13 ms |
6156 KB |
Output is correct |
13 |
Correct |
16 ms |
6156 KB |
Output is correct |
14 |
Correct |
9 ms |
6156 KB |
Output is correct |
15 |
Correct |
13 ms |
6156 KB |
Output is correct |
16 |
Correct |
13 ms |
6156 KB |
Output is correct |
17 |
Incorrect |
13 ms |
6156 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |