/*
Editor: Abdelrahman Hossam
Nickname: Blobo2_Blobo2
IOI next year isA :)
*/
/*#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loop")*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define all(v) v.begin(),v.end()
#define gen(arr,n,nxt) generate(arr,arr+n,nxt)
#define Blobo2 ios_base::sync_with_stdio(false);cin.tie(0);
const int mo=1e9+7;
int nxt(){int x;cin>>x;return x;}
int arr[2001],n,l,r;
int dp[2001][2001];
int solve(int idx=0,int part=0,int sum=0){
//cout<<idx<<' '<<part<<' '<<sum<<endl;
if(part>r)
return 1e18;
if(idx==n){
if(part + (sum > 0)<l || part + (sum > 0) > r)return 1e18;
return sum;
}
int ret = 0;
//if(ret!=-1)return ret;
return ret = min(solve(idx+1,part+1,0)|(sum+arr[idx]),
solve(idx+1,part,sum+arr[idx]));
}
signed main(){
Blobo2
n=nxt(),l=nxt(),r=nxt();
gen(arr,n,nxt);
memset(dp,-1,sizeof dp);
cout<<solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
31652 KB |
Output is correct |
2 |
Correct |
13 ms |
31560 KB |
Output is correct |
3 |
Correct |
14 ms |
31648 KB |
Output is correct |
4 |
Correct |
14 ms |
31576 KB |
Output is correct |
5 |
Correct |
14 ms |
31572 KB |
Output is correct |
6 |
Correct |
14 ms |
31572 KB |
Output is correct |
7 |
Correct |
15 ms |
31572 KB |
Output is correct |
8 |
Correct |
15 ms |
31572 KB |
Output is correct |
9 |
Correct |
17 ms |
31572 KB |
Output is correct |
10 |
Correct |
16 ms |
31564 KB |
Output is correct |
11 |
Correct |
13 ms |
31572 KB |
Output is correct |
12 |
Correct |
14 ms |
31572 KB |
Output is correct |
13 |
Correct |
21 ms |
31664 KB |
Output is correct |
14 |
Correct |
16 ms |
31572 KB |
Output is correct |
15 |
Correct |
17 ms |
31640 KB |
Output is correct |
16 |
Correct |
16 ms |
31568 KB |
Output is correct |
17 |
Correct |
14 ms |
31572 KB |
Output is correct |
18 |
Correct |
14 ms |
31560 KB |
Output is correct |
19 |
Correct |
13 ms |
31572 KB |
Output is correct |
20 |
Correct |
13 ms |
31568 KB |
Output is correct |
21 |
Incorrect |
14 ms |
31632 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
31572 KB |
Output is correct |
2 |
Correct |
17 ms |
31592 KB |
Output is correct |
3 |
Correct |
17 ms |
31572 KB |
Output is correct |
4 |
Correct |
14 ms |
31652 KB |
Output is correct |
5 |
Correct |
13 ms |
31572 KB |
Output is correct |
6 |
Correct |
15 ms |
31572 KB |
Output is correct |
7 |
Correct |
14 ms |
31572 KB |
Output is correct |
8 |
Correct |
12 ms |
31572 KB |
Output is correct |
9 |
Correct |
14 ms |
31572 KB |
Output is correct |
10 |
Correct |
14 ms |
31572 KB |
Output is correct |
11 |
Correct |
13 ms |
31572 KB |
Output is correct |
12 |
Correct |
14 ms |
31572 KB |
Output is correct |
13 |
Correct |
19 ms |
31572 KB |
Output is correct |
14 |
Correct |
14 ms |
31572 KB |
Output is correct |
15 |
Correct |
15 ms |
31604 KB |
Output is correct |
16 |
Correct |
15 ms |
31572 KB |
Output is correct |
17 |
Correct |
16 ms |
31564 KB |
Output is correct |
18 |
Correct |
15 ms |
31664 KB |
Output is correct |
19 |
Correct |
14 ms |
31656 KB |
Output is correct |
20 |
Correct |
14 ms |
31664 KB |
Output is correct |
21 |
Incorrect |
15 ms |
31572 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
31572 KB |
Output is correct |
2 |
Correct |
14 ms |
31572 KB |
Output is correct |
3 |
Correct |
14 ms |
31620 KB |
Output is correct |
4 |
Correct |
13 ms |
31572 KB |
Output is correct |
5 |
Correct |
18 ms |
31644 KB |
Output is correct |
6 |
Correct |
15 ms |
31572 KB |
Output is correct |
7 |
Correct |
14 ms |
31572 KB |
Output is correct |
8 |
Correct |
14 ms |
31572 KB |
Output is correct |
9 |
Correct |
15 ms |
31648 KB |
Output is correct |
10 |
Correct |
15 ms |
31620 KB |
Output is correct |
11 |
Correct |
14 ms |
31572 KB |
Output is correct |
12 |
Correct |
14 ms |
31548 KB |
Output is correct |
13 |
Correct |
20 ms |
31668 KB |
Output is correct |
14 |
Correct |
25 ms |
31660 KB |
Output is correct |
15 |
Correct |
86 ms |
31588 KB |
Output is correct |
16 |
Correct |
34 ms |
31656 KB |
Output is correct |
17 |
Execution timed out |
1073 ms |
31572 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
31572 KB |
Output is correct |
2 |
Correct |
14 ms |
31572 KB |
Output is correct |
3 |
Correct |
13 ms |
31572 KB |
Output is correct |
4 |
Correct |
14 ms |
31568 KB |
Output is correct |
5 |
Correct |
13 ms |
31584 KB |
Output is correct |
6 |
Correct |
14 ms |
31560 KB |
Output is correct |
7 |
Correct |
14 ms |
31572 KB |
Output is correct |
8 |
Correct |
16 ms |
31572 KB |
Output is correct |
9 |
Correct |
12 ms |
31572 KB |
Output is correct |
10 |
Correct |
15 ms |
31556 KB |
Output is correct |
11 |
Correct |
14 ms |
31628 KB |
Output is correct |
12 |
Correct |
14 ms |
31572 KB |
Output is correct |
13 |
Correct |
25 ms |
31572 KB |
Output is correct |
14 |
Correct |
13 ms |
31572 KB |
Output is correct |
15 |
Correct |
13 ms |
31664 KB |
Output is correct |
16 |
Correct |
13 ms |
31572 KB |
Output is correct |
17 |
Correct |
14 ms |
31572 KB |
Output is correct |
18 |
Correct |
13 ms |
31544 KB |
Output is correct |
19 |
Correct |
14 ms |
31572 KB |
Output is correct |
20 |
Correct |
14 ms |
31572 KB |
Output is correct |
21 |
Incorrect |
16 ms |
31668 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
31572 KB |
Output is correct |
2 |
Correct |
14 ms |
31572 KB |
Output is correct |
3 |
Correct |
14 ms |
31576 KB |
Output is correct |
4 |
Correct |
13 ms |
31572 KB |
Output is correct |
5 |
Correct |
13 ms |
31600 KB |
Output is correct |
6 |
Correct |
14 ms |
31572 KB |
Output is correct |
7 |
Correct |
14 ms |
31572 KB |
Output is correct |
8 |
Correct |
14 ms |
31572 KB |
Output is correct |
9 |
Correct |
12 ms |
31660 KB |
Output is correct |
10 |
Correct |
14 ms |
31572 KB |
Output is correct |
11 |
Correct |
14 ms |
31572 KB |
Output is correct |
12 |
Correct |
14 ms |
31564 KB |
Output is correct |
13 |
Correct |
24 ms |
31572 KB |
Output is correct |
14 |
Correct |
13 ms |
31572 KB |
Output is correct |
15 |
Correct |
15 ms |
31612 KB |
Output is correct |
16 |
Correct |
13 ms |
31588 KB |
Output is correct |
17 |
Correct |
13 ms |
31572 KB |
Output is correct |
18 |
Incorrect |
15 ms |
31700 KB |
Output isn't correct |
19 |
Halted |
0 ms |
0 KB |
- |