답안 #260794

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
260794 2020-08-11T02:00:15 Z jeqcho Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define f first
#define s second

int const n=2e3;
int N,A,B;
int Y[n];

ll recur(int now, vector<ll> sum, int cnt)
{
    if(cnt>B)return 2e12+5;
    ll cand=0;
    ll ans=2e12+5;
    FOR(i,now,N)
    {
        cand += Y[i];
        sum.pb(cand);
        if(i==N-1)
        {
            if(cnt<A)return ans;
            ans=0;
            trav(e,sum)
            {
                ans = ans | e;
            }
            return ans;
        }
        ans = min(ans, recur(i+1,sum,cnt+1));
        sum.pop_back();
    }
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>N>>A>>B;
    F0R(i,N)cin>>Y[i];
    ll ans = recur(0, vector<ll> {0}, 0);
    cout<<ans<<'\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -