Submission #260794

#TimeUsernameProblemLanguageResultExecution timeMemory
260794jeqchoBali Sculptures (APIO15_sculpture)C++17
0 / 100
1 ms384 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<pair<int,int>> vpi; #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i) #define R0F(i,a) ROF(i,0,a) #define trav(a,x) for (auto& a: x) #define pb push_back #define rsz resize #define sz(x) int(x.size()) #define all(x) begin(x), end(x) #define f first #define s second int const n=2e3; int N,A,B; int Y[n]; ll recur(int now, vector<ll> sum, int cnt) { if(cnt>B)return 2e12+5; ll cand=0; ll ans=2e12+5; FOR(i,now,N) { cand += Y[i]; sum.pb(cand); if(i==N-1) { if(cnt<A)return ans; ans=0; trav(e,sum) { ans = ans | e; } return ans; } ans = min(ans, recur(i+1,sum,cnt+1)); sum.pop_back(); } return ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>N>>A>>B; F0R(i,N)cin>>Y[i]; ll ans = recur(0, vector<ll> {0}, 0); 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...