답안 #109441

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
109441 2019-05-06T14:41:20 Z dupreez Bali Sculptures (APIO15_sculpture) C++14
21 / 100
113 ms 28636 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[110][1 << 15],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 << 15); 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 << 15); s++) { if (dp[n][s] != -1 && dp[n][s] <= bv) { cout << s << endl; break; } }
	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 14464 KB Output is correct
2 Correct 14 ms 14464 KB Output is correct
3 Correct 12 ms 14464 KB Output is correct
4 Correct 16 ms 14464 KB Output is correct
5 Correct 14 ms 14464 KB Output is correct
6 Correct 15 ms 14464 KB Output is correct
7 Correct 15 ms 14464 KB Output is correct
8 Correct 16 ms 14464 KB Output is correct
9 Correct 16 ms 14464 KB Output is correct
10 Correct 19 ms 14464 KB Output is correct
11 Correct 16 ms 14464 KB Output is correct
12 Correct 16 ms 14464 KB Output is correct
13 Correct 21 ms 14456 KB Output is correct
14 Correct 14 ms 14464 KB Output is correct
15 Incorrect 16 ms 14464 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 14464 KB Output is correct
2 Correct 15 ms 14384 KB Output is correct
3 Correct 16 ms 14464 KB Output is correct
4 Correct 14 ms 14464 KB Output is correct
5 Correct 13 ms 14592 KB Output is correct
6 Correct 17 ms 14464 KB Output is correct
7 Correct 17 ms 14464 KB Output is correct
8 Correct 17 ms 14464 KB Output is correct
9 Correct 21 ms 14464 KB Output is correct
10 Correct 18 ms 14464 KB Output is correct
11 Correct 24 ms 14464 KB Output is correct
12 Correct 20 ms 14464 KB Output is correct
13 Correct 18 ms 14464 KB Output is correct
14 Correct 14 ms 14464 KB Output is correct
15 Incorrect 13 ms 14464 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 14464 KB Output is correct
2 Correct 15 ms 14464 KB Output is correct
3 Correct 16 ms 14416 KB Output is correct
4 Correct 15 ms 14464 KB Output is correct
5 Correct 16 ms 14464 KB Output is correct
6 Correct 15 ms 14464 KB Output is correct
7 Correct 15 ms 14464 KB Output is correct
8 Correct 18 ms 14464 KB Output is correct
9 Correct 16 ms 14464 KB Output is correct
10 Correct 17 ms 14460 KB Output is correct
11 Correct 17 ms 14360 KB Output is correct
12 Correct 17 ms 14464 KB Output is correct
13 Correct 29 ms 14464 KB Output is correct
14 Correct 18 ms 14464 KB Output is correct
15 Correct 21 ms 14464 KB Output is correct
16 Correct 24 ms 14464 KB Output is correct
17 Correct 25 ms 14464 KB Output is correct
18 Correct 52 ms 14464 KB Output is correct
19 Correct 32 ms 14468 KB Output is correct
20 Correct 29 ms 14464 KB Output is correct
21 Correct 37 ms 14412 KB Output is correct
22 Correct 38 ms 14464 KB Output is correct
23 Correct 29 ms 14464 KB Output is correct
24 Correct 33 ms 14464 KB Output is correct
25 Correct 41 ms 14508 KB Output is correct
26 Correct 54 ms 14464 KB Output is correct
27 Correct 71 ms 14464 KB Output is correct
28 Correct 84 ms 14464 KB Output is correct
29 Correct 98 ms 14464 KB Output is correct
30 Correct 113 ms 14584 KB Output is correct
31 Correct 88 ms 14464 KB Output is correct
32 Correct 85 ms 14464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 14464 KB Output is correct
2 Correct 17 ms 14428 KB Output is correct
3 Correct 12 ms 14464 KB Output is correct
4 Correct 13 ms 14464 KB Output is correct
5 Correct 14 ms 14464 KB Output is correct
6 Correct 15 ms 14464 KB Output is correct
7 Correct 18 ms 14472 KB Output is correct
8 Correct 18 ms 14464 KB Output is correct
9 Correct 16 ms 14592 KB Output is correct
10 Correct 15 ms 14464 KB Output is correct
11 Correct 17 ms 14464 KB Output is correct
12 Correct 19 ms 14464 KB Output is correct
13 Correct 17 ms 14480 KB Output is correct
14 Correct 13 ms 14464 KB Output is correct
15 Incorrect 14 ms 14464 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 14464 KB Output is correct
2 Correct 14 ms 14464 KB Output is correct
3 Correct 14 ms 14464 KB Output is correct
4 Correct 13 ms 14464 KB Output is correct
5 Correct 15 ms 14464 KB Output is correct
6 Correct 17 ms 14464 KB Output is correct
7 Correct 16 ms 14504 KB Output is correct
8 Correct 17 ms 14464 KB Output is correct
9 Correct 15 ms 14464 KB Output is correct
10 Correct 17 ms 14464 KB Output is correct
11 Correct 17 ms 14464 KB Output is correct
12 Correct 17 ms 14464 KB Output is correct
13 Correct 16 ms 14464 KB Output is correct
14 Runtime error 34 ms 28636 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Halted 0 ms 0 KB -