/*
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,tune=native")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loops")
#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_el_7akim_elly_3ayz_yro7_IOI_w_3ayz_yakol_jilaty ios_base::sync_with_stdio(false);cin.tie(0);
const int mo=1e9+7,INF=1e18;
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=1,int sum=0){
//cout<<idx<<' '<<part<<' '<<sum<<endl;
if(part>r)
return 1e9;
if(idx==n){
if(sum)return sum;
if(part<l)return 1e9;
return 0;
}
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_el_7akim_elly_3ayz_yro7_IOI_w_3ayz_yakol_jilaty
n=nxt(),l=nxt(),r=nxt();
gen(arr,n,nxt);
memset(dp,-1,sizeof dp);
cout<<solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
31564 KB |
Output is correct |
2 |
Correct |
15 ms |
31564 KB |
Output is correct |
3 |
Correct |
16 ms |
31652 KB |
Output is correct |
4 |
Correct |
14 ms |
31636 KB |
Output is correct |
5 |
Correct |
16 ms |
31576 KB |
Output is correct |
6 |
Correct |
14 ms |
31564 KB |
Output is correct |
7 |
Correct |
17 ms |
31620 KB |
Output is correct |
8 |
Correct |
14 ms |
31556 KB |
Output is correct |
9 |
Correct |
14 ms |
31564 KB |
Output is correct |
10 |
Correct |
15 ms |
31640 KB |
Output is correct |
11 |
Correct |
14 ms |
31564 KB |
Output is correct |
12 |
Correct |
14 ms |
31564 KB |
Output is correct |
13 |
Correct |
20 ms |
31664 KB |
Output is correct |
14 |
Correct |
15 ms |
31564 KB |
Output is correct |
15 |
Incorrect |
14 ms |
31564 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
31564 KB |
Output is correct |
2 |
Correct |
14 ms |
31564 KB |
Output is correct |
3 |
Correct |
15 ms |
31564 KB |
Output is correct |
4 |
Correct |
14 ms |
31564 KB |
Output is correct |
5 |
Correct |
14 ms |
31564 KB |
Output is correct |
6 |
Correct |
15 ms |
31572 KB |
Output is correct |
7 |
Correct |
15 ms |
31564 KB |
Output is correct |
8 |
Correct |
15 ms |
31616 KB |
Output is correct |
9 |
Correct |
18 ms |
31532 KB |
Output is correct |
10 |
Correct |
14 ms |
31564 KB |
Output is correct |
11 |
Correct |
14 ms |
31632 KB |
Output is correct |
12 |
Correct |
14 ms |
31544 KB |
Output is correct |
13 |
Correct |
19 ms |
31572 KB |
Output is correct |
14 |
Correct |
15 ms |
31620 KB |
Output is correct |
15 |
Incorrect |
15 ms |
31564 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
31564 KB |
Output is correct |
2 |
Correct |
14 ms |
31588 KB |
Output is correct |
3 |
Correct |
14 ms |
31540 KB |
Output is correct |
4 |
Correct |
14 ms |
31560 KB |
Output is correct |
5 |
Correct |
15 ms |
31588 KB |
Output is correct |
6 |
Correct |
15 ms |
31636 KB |
Output is correct |
7 |
Correct |
14 ms |
31564 KB |
Output is correct |
8 |
Correct |
17 ms |
31564 KB |
Output is correct |
9 |
Correct |
15 ms |
31576 KB |
Output is correct |
10 |
Correct |
15 ms |
31564 KB |
Output is correct |
11 |
Correct |
14 ms |
31564 KB |
Output is correct |
12 |
Correct |
15 ms |
31620 KB |
Output is correct |
13 |
Correct |
19 ms |
31552 KB |
Output is correct |
14 |
Correct |
24 ms |
31564 KB |
Output is correct |
15 |
Correct |
49 ms |
31672 KB |
Output is correct |
16 |
Correct |
18 ms |
31564 KB |
Output is correct |
17 |
Execution timed out |
1077 ms |
31656 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
31564 KB |
Output is correct |
2 |
Correct |
16 ms |
31768 KB |
Output is correct |
3 |
Correct |
15 ms |
31552 KB |
Output is correct |
4 |
Correct |
15 ms |
31564 KB |
Output is correct |
5 |
Correct |
14 ms |
31564 KB |
Output is correct |
6 |
Correct |
15 ms |
31624 KB |
Output is correct |
7 |
Correct |
14 ms |
31580 KB |
Output is correct |
8 |
Correct |
14 ms |
31660 KB |
Output is correct |
9 |
Correct |
15 ms |
31644 KB |
Output is correct |
10 |
Correct |
15 ms |
31628 KB |
Output is correct |
11 |
Correct |
14 ms |
31552 KB |
Output is correct |
12 |
Correct |
14 ms |
31540 KB |
Output is correct |
13 |
Correct |
18 ms |
31568 KB |
Output is correct |
14 |
Correct |
15 ms |
31552 KB |
Output is correct |
15 |
Incorrect |
14 ms |
31564 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
31564 KB |
Output is correct |
2 |
Correct |
17 ms |
31576 KB |
Output is correct |
3 |
Correct |
14 ms |
31564 KB |
Output is correct |
4 |
Correct |
14 ms |
31564 KB |
Output is correct |
5 |
Correct |
17 ms |
31544 KB |
Output is correct |
6 |
Correct |
15 ms |
31564 KB |
Output is correct |
7 |
Correct |
14 ms |
31564 KB |
Output is correct |
8 |
Correct |
14 ms |
31548 KB |
Output is correct |
9 |
Correct |
14 ms |
31604 KB |
Output is correct |
10 |
Correct |
14 ms |
31588 KB |
Output is correct |
11 |
Correct |
14 ms |
31564 KB |
Output is correct |
12 |
Correct |
14 ms |
31596 KB |
Output is correct |
13 |
Correct |
18 ms |
31640 KB |
Output is correct |
14 |
Correct |
14 ms |
31564 KB |
Output is correct |
15 |
Incorrect |
15 ms |
31564 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |