Submission #950345

#TimeUsernameProblemLanguageResultExecution timeMemory
950345UnforgettableplBali Sculptures (APIO15_sculpture)C++17
0 / 100
1 ms600 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int arr[2001]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n,a,b; cin >> n >> a >> b; for(int i=0;i<n;i++)cin>>arr[i]; int ans = INT64_MAX; for(int subset=0;subset<(1<<(n-1));subset++){ if(__builtin_popcount(subset)!=(b-1))continue; int curr = 0; int currsum = 0; for(int i=0;i<n-1;i++){ currsum+=arr[i]; if(subset&(1<<i)){ curr|=currsum; currsum=0; } } curr|=currsum+arr[n-1]; ans = min(ans,curr); } cout << ans << '\n'; }
#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...