Submission #1075400

#TimeUsernameProblemLanguageResultExecution timeMemory
1075400HappyCapybaraBali Sculptures (APIO15_sculpture)C++17
0 / 100
10 ms600 KiB
#include<bits/stdc++.h> using namespace std; #define int long long signed main(){ int n, a, b; cin >> n >> a >> b; vector<int> v(n); for (int i=0; i<n; i++) cin >> v[i]; int bsf = pow(10, 11); for (int i=0; i<(1<<(n-1)); i++){ //cout << i << "\n"; int pc = 0; for (int j=0; j<n-2; j++){ if (i & (1<<j)) pc++; } if (pc < a-1 || pc > b-1) continue; //cout << pc << "\n"; vector<int> w; int cur = 0; for (int j=0; j<n; j++){ cur += v[j]; if (i & (1<<j) || j == n-1){ w.push_back(cur); cur = 0; } } int res = 0; for (int x : w) res |= x; //cout << i << " " << res << "\n"; bsf = min(bsf, res); } cout << bsf << "\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...