답안 #109438

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
109438 2019-05-06T14:33:46 Z dupreez Bali Sculptures (APIO15_sculpture) C++14
0 / 100
244 ms 263168 KB
#include <iostream>
#include <algorithm>
#include <cstring>
#include <sstream>
#include <map>
#include <queue>
#include <vector>
#include <deque>
#include <climits>
#define scanf scanf_s
#define mk make_pair
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pos;
const ll MOD = 1000000007, N = 2010;

ll min2(ll v1, ll v2) { if (v1 == -1)return v2; if (v2 == -1)return v1; return min(v1, v2); }

int dp[100][1 << 20],a[110],n,av,bv;

int main() {
	memset(dp, -1, sizeof(dp));
	dp[0][0] = 0;
	cin >> n >> av >> bv;
	for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] += a[i - 1]; }
	for (int i = 0; i < n; i++) {
		for (int i2 = i + 1; i2 <= n; i2++) {
			int v1 = a[i2] - a[i];
			for (int s = 0; s < (1 << 20); s++) {
				if (dp[i][s] == -1)continue;
				dp[i2][s | v1] = min2(dp[i2][s | v1], dp[i][s] + 1);
			}
		}
	}
	for (int s = 0; s < (1 << 20); s++) { if (dp[n][s] != -1 && dp[n][s] <= bv) { cout << s << endl; break; } }
	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Runtime error 222 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 244 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 220 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 208 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 206 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -