답안 #435222

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
435222 2021-06-23T05:42:04 Z sinamhdv Bali Sculptures (APIO15_sculpture) C++11
71 / 100
62 ms 460 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int mod = 1000 * 1000 * 1000 + 7;
const int INF = 1e9 + 100;
const ll LINF = 1e18 + 100;

#ifdef DEBUG
#define dbg(x) cout << #x << " = " << (x) << endl << flush;
#define dbgr(s, f) { cout << #s << ": "; for (auto _ = (s); _ != (f); _++) cout << *_ << ' '; cout << endl << flush; }
#else
#define dbg(x) ;
#define dbgr(s, f) ;
#endif
#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
#define fast_io ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define endl '\n'

#define MAXN 110
#define LOGN 43

int n, A, B, a[MAXN];
bool dp[MAXN][MAXN];
ll ps[MAXN];

int32_t main(void)
{
	fast_io;
	cin >> n >> A >> B;
	FOR(i, 1, n + 1) cin >> a[i], ps[i] = ps[i - 1] + a[i];

	ll mask = 0;
	for (int b = LOGN - 1; b >= 0; b--)
	{
		memset(dp, 0, sizeof(dp));
		dp[0][0] = 1;
		FOR(k, 1, n + 1)
		{
			FOR(i, 1, n + 1)
			{
				FOR(j, 0, i)
				{
					ll sm = (ps[i] - ps[j]) & (~((1ll << b) - 1));
					if ((sm | mask) != mask) continue;
					dp[k][i] |= dp[k - 1][j];
				}
			}
		}
		bool ok = false;
		FOR(i, A, B + 1) ok |= dp[i][n];
		if (!ok) mask |= (1ll << b);
	}

	cout << mask << endl;

	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 312 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 1 ms 316 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 312 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 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 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 2 ms 332 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
29 Correct 1 ms 316 KB Output is correct
30 Correct 2 ms 316 KB Output is correct
31 Correct 1 ms 324 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 2 ms 316 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 2 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 316 KB Output is correct
2 Correct 1 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 312 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 2 ms 332 KB Output is correct
10 Correct 1 ms 312 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 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 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 2 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
29 Correct 4 ms 204 KB Output is correct
30 Correct 5 ms 204 KB Output is correct
31 Correct 7 ms 204 KB Output is correct
32 Correct 7 ms 204 KB Output is correct
33 Correct 9 ms 328 KB Output is correct
34 Correct 7 ms 204 KB Output is correct
35 Correct 7 ms 204 KB Output is correct
36 Correct 7 ms 320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 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 1 ms 204 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 316 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 3 ms 204 KB Output is correct
17 Correct 4 ms 212 KB Output is correct
18 Correct 6 ms 204 KB Output is correct
19 Correct 7 ms 204 KB Output is correct
20 Correct 8 ms 324 KB Output is correct
21 Correct 7 ms 204 KB Output is correct
22 Correct 9 ms 324 KB Output is correct
23 Correct 8 ms 204 KB Output is correct
24 Correct 8 ms 336 KB Output is correct
25 Correct 15 ms 320 KB Output is correct
26 Correct 24 ms 204 KB Output is correct
27 Correct 38 ms 204 KB Output is correct
28 Correct 52 ms 204 KB Output is correct
29 Correct 49 ms 316 KB Output is correct
30 Correct 54 ms 316 KB Output is correct
31 Correct 52 ms 304 KB Output is correct
32 Correct 55 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 312 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 1 ms 204 KB Output is correct
7 Correct 1 ms 224 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 2 ms 204 KB Output is correct
13 Correct 2 ms 204 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 312 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 324 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 312 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 316 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 316 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 312 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 3 ms 204 KB Output is correct
40 Correct 5 ms 204 KB Output is correct
41 Correct 8 ms 204 KB Output is correct
42 Correct 8 ms 304 KB Output is correct
43 Correct 8 ms 324 KB Output is correct
44 Correct 7 ms 256 KB Output is correct
45 Correct 8 ms 316 KB Output is correct
46 Correct 7 ms 204 KB Output is correct
47 Correct 8 ms 204 KB Output is correct
48 Correct 15 ms 320 KB Output is correct
49 Correct 24 ms 204 KB Output is correct
50 Correct 39 ms 304 KB Output is correct
51 Correct 58 ms 316 KB Output is correct
52 Correct 51 ms 204 KB Output is correct
53 Correct 54 ms 204 KB Output is correct
54 Correct 53 ms 300 KB Output is correct
55 Correct 56 ms 204 KB Output is correct
56 Correct 7 ms 204 KB Output is correct
57 Correct 31 ms 204 KB Output is correct
58 Correct 36 ms 204 KB Output is correct
59 Correct 47 ms 204 KB Output is correct
60 Correct 48 ms 204 KB Output is correct
61 Correct 42 ms 204 KB Output is correct
62 Correct 61 ms 204 KB Output is correct
63 Correct 56 ms 308 KB Output is correct
64 Correct 42 ms 204 KB Output is correct
65 Correct 7 ms 316 KB Output is correct
66 Correct 14 ms 204 KB Output is correct
67 Correct 23 ms 324 KB Output is correct
68 Correct 35 ms 204 KB Output is correct
69 Correct 62 ms 312 KB Output is correct
70 Correct 42 ms 204 KB Output is correct
71 Correct 45 ms 204 KB Output is correct
72 Correct 55 ms 204 KB Output is correct
73 Correct 48 ms 204 KB Output is correct
74 Correct 49 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 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 316 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 352 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 312 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 320 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 1 ms 204 KB Output is correct
18 Correct 1 ms 316 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 4 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 352 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 2 ms 204 KB Output is correct
26 Correct 5 ms 204 KB Output is correct
27 Correct 4 ms 204 KB Output is correct
28 Correct 7 ms 204 KB Output is correct
29 Correct 6 ms 324 KB Output is correct
30 Correct 9 ms 204 KB Output is correct
31 Correct 7 ms 320 KB Output is correct
32 Correct 8 ms 324 KB Output is correct
33 Correct 7 ms 252 KB Output is correct
34 Correct 7 ms 328 KB Output is correct
35 Correct 17 ms 316 KB Output is correct
36 Correct 27 ms 204 KB Output is correct
37 Correct 44 ms 308 KB Output is correct
38 Correct 58 ms 304 KB Output is correct
39 Correct 52 ms 304 KB Output is correct
40 Correct 52 ms 312 KB Output is correct
41 Correct 56 ms 204 KB Output is correct
42 Correct 52 ms 204 KB Output is correct
43 Correct 9 ms 316 KB Output is correct
44 Correct 24 ms 328 KB Output is correct
45 Correct 40 ms 300 KB Output is correct
46 Correct 49 ms 308 KB Output is correct
47 Correct 57 ms 308 KB Output is correct
48 Correct 46 ms 204 KB Output is correct
49 Correct 52 ms 304 KB Output is correct
50 Correct 51 ms 316 KB Output is correct
51 Correct 59 ms 316 KB Output is correct
52 Runtime error 2 ms 460 KB Execution killed with signal 11
53 Halted 0 ms 0 KB -