답안 #124024

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
124024 2019-07-02T11:25:58 Z amiratou Bali Sculptures (APIO15_sculpture) C++14
0 / 100
50 ms 49400 KB
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 100000000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
ll tab[2500],dp[2500][2500];
ll n,A,B;

ll solve(int idx,int k,ll sum){

    //debugs(idx,k);
    //debug(sum);
    if(k>B)return LLONG_MAX;
    if(idx==n&&(k>=A)&&(k<=B))return sum;
    if(idx==n)return LLONG_MAX;
    ll ans=LLONG_MAX;
    //debug(ans);
    ans=min(ans,solve(idx+1,k,sum+tab[idx]));
    ans=min(ans,sum|solve(idx+1,k+1,tab[idx]));
    return ans;
}
int main(){
    boost;
    memset(dp,-1,sizeof dp);
    cin>>n>>A>>B;
    for (int i = 0; i < n; ++i)
        cin>>tab[i];
    cout<<solve(0,0,0);
    return 0;
}
//long long
//array bounds
//special cases
//binary search
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 49272 KB Output is correct
2 Correct 42 ms 49272 KB Output is correct
3 Correct 43 ms 49276 KB Output is correct
4 Correct 43 ms 49272 KB Output is correct
5 Incorrect 42 ms 49272 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 49244 KB Output is correct
2 Correct 42 ms 49272 KB Output is correct
3 Correct 43 ms 49272 KB Output is correct
4 Correct 42 ms 49272 KB Output is correct
5 Incorrect 42 ms 49276 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 49320 KB Output is correct
2 Correct 42 ms 49272 KB Output is correct
3 Correct 43 ms 49244 KB Output is correct
4 Correct 50 ms 49272 KB Output is correct
5 Incorrect 43 ms 49308 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 49272 KB Output is correct
2 Correct 43 ms 49272 KB Output is correct
3 Correct 43 ms 49272 KB Output is correct
4 Correct 43 ms 49272 KB Output is correct
5 Incorrect 42 ms 49272 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 49272 KB Output is correct
2 Correct 43 ms 49272 KB Output is correct
3 Correct 44 ms 49400 KB Output is correct
4 Correct 49 ms 49272 KB Output is correct
5 Incorrect 50 ms 49220 KB Output isn't correct
6 Halted 0 ms 0 KB -