답안 #452617

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
452617 2021-08-04T05:18:16 Z hibye1217 Bali Sculptures (APIO15_sculpture) C++17
0 / 100
535 ms 332 KB
// Subtask 1

#include <bits/stdc++.h>
#define endl '\n'
#define fr first
#define sc second
#define all(v) v.begin(),v.end()
#define unq(v) sort( all(v) ); v.erase( unique( all(v) ), v.end() )
#define bout(x) cout << bitset<sizeof(x)*8>(x) << endl
#define mkp(a,b) make_pair(a,b)
#define gcd(a,b) __gcd(a,b)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pi2 = pair<int, int>;
using pl2 = pair<ll, ll>;
using cpl = complex<ld>;
const ld pi = 3.14159265358979323846264338327950288;
const ld tau = 2 * pi;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, ddy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int nx[8] = {1, 2, 2, 1, -1, -2, -2, -1}, ny[8] = {-2, -1, 1, 2, 2, 1, -1, -2};

// #define DEBUG

int n, a, b; ll arr[30];
ll sum[30];
ll ans = 1e18;

void btk(int idx, int ptr){
	if (idx > n){
		if (a > ptr || ptr > b){ return; }
		ll res = 0;
		for (int i = 1; i <= ptr; i++){
			res |= sum[i];
		}
		ans = min(ans, res);
		return;
	}
	sum[ptr] += arr[idx]; btk(idx+1, ptr); sum[ptr] -= arr[idx];
	sum[ptr+1] += arr[idx]; btk(idx+1, ptr+1); sum[ptr+1] -= arr[idx];
}

void Main(){
	cin >> n >> a >> b;
	for (int i = 1; i <= n; i++){ cin >> arr[i]; }
	btk(1, 1);
	cout << ans;
}

int main(){
#ifndef DEBUG
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#endif
	cout.setf(ios::fixed);
	cout.precision(0);
	Main();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 3 ms 312 KB Output is correct
8 Correct 16 ms 312 KB Output is correct
9 Correct 15 ms 204 KB Output is correct
10 Correct 16 ms 316 KB Output is correct
11 Correct 18 ms 204 KB Output is correct
12 Correct 19 ms 308 KB Output is correct
13 Correct 20 ms 312 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Incorrect 1 ms 204 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 16 ms 312 KB Output is correct
9 Correct 15 ms 308 KB Output is correct
10 Correct 16 ms 308 KB Output is correct
11 Correct 16 ms 312 KB Output is correct
12 Correct 16 ms 204 KB Output is correct
13 Correct 23 ms 308 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Incorrect 1 ms 204 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 16 ms 312 KB Output is correct
9 Correct 17 ms 316 KB Output is correct
10 Correct 16 ms 312 KB Output is correct
11 Correct 15 ms 308 KB Output is correct
12 Correct 16 ms 204 KB Output is correct
13 Correct 21 ms 204 KB Output is correct
14 Correct 41 ms 204 KB Output is correct
15 Correct 504 ms 292 KB Output is correct
16 Incorrect 1 ms 204 KB Output isn't correct
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 3 ms 204 KB Output is correct
8 Correct 16 ms 316 KB Output is correct
9 Correct 16 ms 316 KB Output is correct
10 Correct 15 ms 204 KB Output is correct
11 Correct 16 ms 308 KB Output is correct
12 Correct 16 ms 312 KB Output is correct
13 Correct 20 ms 308 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Incorrect 1 ms 204 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 15 ms 316 KB Output is correct
9 Correct 15 ms 204 KB Output is correct
10 Correct 17 ms 284 KB Output is correct
11 Correct 17 ms 308 KB Output is correct
12 Correct 15 ms 308 KB Output is correct
13 Correct 22 ms 304 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 8 ms 204 KB Output is correct
18 Correct 16 ms 312 KB Output is correct
19 Correct 17 ms 204 KB Output is correct
20 Correct 24 ms 204 KB Output is correct
21 Correct 21 ms 204 KB Output is correct
22 Correct 15 ms 312 KB Output is correct
23 Correct 20 ms 308 KB Output is correct
24 Correct 41 ms 304 KB Output is correct
25 Correct 535 ms 292 KB Output is correct
26 Incorrect 1 ms 316 KB Output isn't correct
27 Halted 0 ms 0 KB -