#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
long long n,y[2050],dp[2050][2050],a,b;
long long f(int x,int g)
{
if(x==n&&a<=g&&g<=b)return 0;
if(x==n)return 1e18;
//if(dp[x][g]!=-1)return dp[x][g];
long long ans=1e18,sum=0;
for(int i=x;i<n;i++)
{
sum+=y[i];
ans=min(ans,(f(i+1,g+1)|sum));
}
return dp[x][g]=ans;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//freopen("empty.in","r",stdin);
//freopen("empty.out","w",stdout);
memset(dp,-1,sizeof dp);
cin>>n>>a>>b;
for(int i=0;i<n;i++)cin>>y[i];
cout<<f(0,0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
33144 KB |
Output is correct |
2 |
Correct |
23 ms |
33272 KB |
Output is correct |
3 |
Correct |
24 ms |
33272 KB |
Output is correct |
4 |
Correct |
25 ms |
33400 KB |
Output is correct |
5 |
Correct |
23 ms |
33272 KB |
Output is correct |
6 |
Correct |
24 ms |
33272 KB |
Output is correct |
7 |
Correct |
25 ms |
33272 KB |
Output is correct |
8 |
Correct |
29 ms |
33272 KB |
Output is correct |
9 |
Correct |
29 ms |
33272 KB |
Output is correct |
10 |
Correct |
30 ms |
33272 KB |
Output is correct |
11 |
Correct |
33 ms |
33272 KB |
Output is correct |
12 |
Correct |
30 ms |
33272 KB |
Output is correct |
13 |
Correct |
29 ms |
33276 KB |
Output is correct |
14 |
Correct |
23 ms |
33272 KB |
Output is correct |
15 |
Correct |
23 ms |
33272 KB |
Output is correct |
16 |
Correct |
23 ms |
33272 KB |
Output is correct |
17 |
Correct |
23 ms |
33276 KB |
Output is correct |
18 |
Correct |
23 ms |
33272 KB |
Output is correct |
19 |
Correct |
23 ms |
33272 KB |
Output is correct |
20 |
Correct |
24 ms |
33272 KB |
Output is correct |
21 |
Incorrect |
30 ms |
33272 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
33272 KB |
Output is correct |
2 |
Correct |
24 ms |
33276 KB |
Output is correct |
3 |
Correct |
24 ms |
33272 KB |
Output is correct |
4 |
Correct |
23 ms |
33272 KB |
Output is correct |
5 |
Correct |
23 ms |
33272 KB |
Output is correct |
6 |
Correct |
23 ms |
33272 KB |
Output is correct |
7 |
Correct |
24 ms |
33272 KB |
Output is correct |
8 |
Correct |
29 ms |
33272 KB |
Output is correct |
9 |
Correct |
29 ms |
33272 KB |
Output is correct |
10 |
Correct |
30 ms |
33272 KB |
Output is correct |
11 |
Correct |
31 ms |
33272 KB |
Output is correct |
12 |
Correct |
32 ms |
33272 KB |
Output is correct |
13 |
Correct |
31 ms |
33272 KB |
Output is correct |
14 |
Correct |
23 ms |
33272 KB |
Output is correct |
15 |
Correct |
23 ms |
33272 KB |
Output is correct |
16 |
Correct |
23 ms |
33276 KB |
Output is correct |
17 |
Correct |
23 ms |
33272 KB |
Output is correct |
18 |
Correct |
23 ms |
33272 KB |
Output is correct |
19 |
Correct |
25 ms |
33272 KB |
Output is correct |
20 |
Correct |
24 ms |
33276 KB |
Output is correct |
21 |
Incorrect |
30 ms |
33272 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
33272 KB |
Output is correct |
2 |
Correct |
23 ms |
33272 KB |
Output is correct |
3 |
Correct |
23 ms |
33272 KB |
Output is correct |
4 |
Correct |
23 ms |
33272 KB |
Output is correct |
5 |
Correct |
23 ms |
33272 KB |
Output is correct |
6 |
Correct |
25 ms |
33272 KB |
Output is correct |
7 |
Correct |
24 ms |
33272 KB |
Output is correct |
8 |
Correct |
30 ms |
33272 KB |
Output is correct |
9 |
Correct |
30 ms |
33272 KB |
Output is correct |
10 |
Correct |
33 ms |
33272 KB |
Output is correct |
11 |
Correct |
29 ms |
33272 KB |
Output is correct |
12 |
Correct |
31 ms |
33272 KB |
Output is correct |
13 |
Correct |
29 ms |
33272 KB |
Output is correct |
14 |
Correct |
37 ms |
33272 KB |
Output is correct |
15 |
Correct |
244 ms |
33276 KB |
Output is correct |
16 |
Execution timed out |
1097 ms |
33272 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
33272 KB |
Output is correct |
2 |
Correct |
24 ms |
33272 KB |
Output is correct |
3 |
Correct |
24 ms |
33272 KB |
Output is correct |
4 |
Correct |
23 ms |
33272 KB |
Output is correct |
5 |
Correct |
23 ms |
33272 KB |
Output is correct |
6 |
Correct |
23 ms |
33272 KB |
Output is correct |
7 |
Correct |
24 ms |
33276 KB |
Output is correct |
8 |
Correct |
30 ms |
33272 KB |
Output is correct |
9 |
Correct |
30 ms |
33272 KB |
Output is correct |
10 |
Correct |
32 ms |
33272 KB |
Output is correct |
11 |
Correct |
29 ms |
33272 KB |
Output is correct |
12 |
Correct |
30 ms |
33272 KB |
Output is correct |
13 |
Correct |
31 ms |
33272 KB |
Output is correct |
14 |
Correct |
23 ms |
33272 KB |
Output is correct |
15 |
Correct |
23 ms |
33272 KB |
Output is correct |
16 |
Correct |
23 ms |
33272 KB |
Output is correct |
17 |
Correct |
23 ms |
33272 KB |
Output is correct |
18 |
Correct |
23 ms |
33272 KB |
Output is correct |
19 |
Correct |
24 ms |
33272 KB |
Output is correct |
20 |
Correct |
24 ms |
33272 KB |
Output is correct |
21 |
Incorrect |
30 ms |
33272 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
33276 KB |
Output is correct |
2 |
Correct |
23 ms |
33272 KB |
Output is correct |
3 |
Correct |
25 ms |
33272 KB |
Output is correct |
4 |
Correct |
23 ms |
33272 KB |
Output is correct |
5 |
Correct |
23 ms |
33272 KB |
Output is correct |
6 |
Correct |
23 ms |
33272 KB |
Output is correct |
7 |
Correct |
25 ms |
33272 KB |
Output is correct |
8 |
Correct |
30 ms |
33272 KB |
Output is correct |
9 |
Correct |
30 ms |
33272 KB |
Output is correct |
10 |
Correct |
30 ms |
33276 KB |
Output is correct |
11 |
Correct |
31 ms |
33248 KB |
Output is correct |
12 |
Correct |
30 ms |
33272 KB |
Output is correct |
13 |
Correct |
30 ms |
33276 KB |
Output is correct |
14 |
Correct |
23 ms |
33272 KB |
Output is correct |
15 |
Correct |
23 ms |
33272 KB |
Output is correct |
16 |
Correct |
22 ms |
33276 KB |
Output is correct |
17 |
Correct |
27 ms |
33272 KB |
Output is correct |
18 |
Incorrect |
29 ms |
33272 KB |
Output isn't correct |
19 |
Halted |
0 ms |
0 KB |
- |