답안 #106368

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
106368 2019-04-18T03:24:11 Z abil Bali Sculptures (APIO15_sculpture) C++14
0 / 100
3 ms 384 KB
#include <bits/stdc++.h>
#define int long long
#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )
#define Scan(a) scanf ("%I64d", &a)
#define scan(a) scanf ("%d", &a)
#define pi pair < int, int >

using namespace std;

const long long INF = (int)1e18 + 7;
const int N = (int)2007;
const int mod = 1000000007;

int n, a, b, ans = INF, arr[N];

void solve(int pos,int sum, int an, int g){
      if(pos - 1 == n){
            if(g >= a && g <= b){
                  ans = min(ans,(an | sum));
            }
            return;
      }
      solve(pos + 1, arr[pos], (an | sum), g + 1);
      solve(pos + 1, (arr[pos] + sum ), an, g);
}
main(){
      cin >> n >> a >> b;
      for(int i = 1;i <= n; i++){
            cin >> arr[i];
      }
      solve(1,arr[1], 0 ,1);
      cout << ans;
}
/*
6 1 3
8 1 2 1 5 4
*/

Compilation message

sculpture.cpp:31:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 3 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -