Submission #212706

#TimeUsernameProblemLanguageResultExecution timeMemory
212706iris2617Bali Sculptures (APIO15_sculpture)C++14
46 / 100
1110 ms249176 KiB
#include <bits/stdc++.h> #define int long long #define iris 998244353 using namespace std; set<int> dp[2010][2010]; int arr[2010]; signed main(){ ios::sync_with_stdio(0); cin.tie(0); int n,ans,i,j,k,a,b; cin>>n>>a>>b; for(i=1;i<=n;i++) { cin>>arr[i]; arr[i]+=arr[i-1]; } dp[0][0].insert(0); for(i=1;i<=b;i++) { for(j=1;j<=n;j++) { for(k=0;k<j;k++) { for(int ouo:dp[i-1][k]) { dp[i][j].insert(ouo|(arr[j]-arr[k])); } } } } ans=1e18; for(i=a;i<=b;i++) { ans=min(ans, *dp[i][n].lower_bound(-1)); } cout<<ans<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...