Submission #1020099

#TimeUsernameProblemLanguageResultExecution timeMemory
1020099KasymKBali Sculptures (APIO15_sculpture)C++17
9 / 100
909 ms604 KiB
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define all(v) v.begin(), v.end()

int main(){
    int n, a, b;
    scanf("%d%d%d", &n, &a, &b);
    vector<int> v(n);
    for(int &i : v)
        scanf("%d", &i);
    ll ans = 1e18;
    for(int mk = 0; mk < (1<<(n-1)); ++mk){
        ll sm = 0, cur = 0;
        int x = 1;
        for(int i = 0; i < n-1; ++i){
            sm += v[i];
            if(mk>>i&1)
                cur |= sm, sm = 0, x++;
        }
        sm += v.back();
        cur |= sm;
        if(a <= x and x <= b)
            ans = min(ans, cur);
    }
    printf("%lld", ans);
    return 0;
}

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d%d%d", &n, &a, &b);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%d", &i);
      |         ~~~~~^~~~~~~~~~
#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...