Submission #104640

#TimeUsernameProblemLanguageResultExecution timeMemory
104640YottaByteBali Sculptures (APIO15_sculpture)C++14
9 / 100
513 ms512 KiB
#include <bits/stdc++.h> using namespace std; const int N = 25; long long n, a, b, ar[N]; long long ans = 1e18; void calc(long long mask) { int one = __builtin_popcount(mask) + 1; if((mask >> (n - 1)) & 1) return; if(a <= one && one <= b) { long long sum = 0, temp = 0; for(int i = 0; i < n; i++) { sum = sum + ar[i]; if(mask & (1 << i)) { temp = temp | sum; sum = 0; } } temp = temp | sum; if(ans > temp) { ans = temp; } } } main() { cin >> n >> a >> b; for(int i = 0; i < n; i++) { cin >> ar[i]; } for(long long i = 0; i < (1 << n); i++) { calc(i); } cout << ans << endl; }

Compilation message (stderr)

sculpture.cpp:30:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
#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...