# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
918302 | 2024-01-29T14:54:16 Z | sq00 | Bali Sculptures (APIO15_sculpture) | C++14 | 1 ms | 356 KB |
#include <bits/stdc++.h> using namespace std; void solve() { int n, a, b; cin >> n >> a >> b; vector<int>v(n + 1); for(int i = 1; i <= n; i++) { cin >> v[i]; } long long ans = 1e18; for(int i = 0; i < (1 << n); i++) { long long g = 0, sum = 0; for(int j = 0; j < n; j++) { sum += v[j + 1]; if(i & (1 << j)) { g |= sum; sum = 0; } } g |= sum; //cout << i << ": " << g << '\n'; int bits = __builtin_popcount(i) + (i & (1 << (n - 1)) == 0); if(a <= bits && bits <= b) ans = min(ans, g); } cout << ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; //cin >> t; while(t--) { solve(); } } /* 6 1 3 8 1 2 1 5 4 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Incorrect | 1 ms | 348 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Incorrect | 0 ms | 348 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Incorrect | 1 ms | 348 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Incorrect | 1 ms | 348 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 356 KB | Output is correct |
5 | Incorrect | 1 ms | 348 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |