This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,a,b,mn=1000000000000000009ll;
ll arr[50];
void bt(ll id,ll sum,ll curr,ll flag,bool flag2){
if(id == n){
if(flag < a || flag > b || !flag2) return;
mn = min(mn,curr); return;
}
sum += arr[id];
bt(id+1,sum,curr,flag,0);
curr |= sum;
bt(id+1,0,curr,flag+1,1);
}
int main(){
cin>>n>>a>>b;
for(int i=0;i<n;i++) cin>>arr[i];
bt(0,0,0,0,0);
cout<<mn<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |