답안 #41425

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
41425 2018-02-17T08:13:14 Z RockyB Bali Sculptures (APIO15_sculpture) C++14
25 / 100
1000 ms 4668 KB
/// In The Name Of God

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

#define f first
#define s second

#define pb push_back
#define pp pop_back
#define mp make_pair

#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()

#define Kazakhstan ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define nl '\n'
#define ioi exit(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = (int)2000 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};

using namespace std;

int n, A, B;
int a[N];

bool ok[N][N];

bool good(ll x, ll mask) {
	if (mask < (x | mask)) return 0;
	return 1;
}
bool dbg;
bool check(int cnt, ll mask) {
	memset(ok, 0, sizeof(ok));
	ok[0][0] = 1;
	for (int id = 1; id <= cnt; id++) {
		for (int i = 1; i <= n; i++) {
			ll sum = 0;
			for (int j = i; j >= 1; j--) {
				sum += a[j];
				if (!good(sum, mask)) {
					continue;
				}
				ok[i][id] |= ok[j - 1][id - 1];
			}
		}
	}
	return ok[n][cnt];
}
int main() {
	#ifdef IOI2018
		freopen ("in.txt", "r", stdin);
	#endif
	Kazakhstan
	cin >> n >> A >> B;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	ll ans = linf;
	for (int j = A; j <= B; j++) {
		ll mask = (1LL << 38) - 1;
		for (int i = 37; i >= 0; i--) {
			mask ^= 1LL << i;
			if (!check(j, mask)) {
				mask ^= 1LL << i;
			}
		}
		ans = min(ans, mask);
	}
	cout << ans;
	ioi
}
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 4216 KB Output is correct
2 Correct 35 ms 4320 KB Output is correct
3 Correct 13 ms 4396 KB Output is correct
4 Correct 28 ms 4464 KB Output is correct
5 Correct 12 ms 4464 KB Output is correct
6 Correct 121 ms 4492 KB Output is correct
7 Correct 29 ms 4492 KB Output is correct
8 Correct 26 ms 4516 KB Output is correct
9 Correct 29 ms 4568 KB Output is correct
10 Correct 27 ms 4568 KB Output is correct
11 Correct 11 ms 4568 KB Output is correct
12 Correct 28 ms 4568 KB Output is correct
13 Correct 143 ms 4568 KB Output is correct
14 Correct 19 ms 4568 KB Output is correct
15 Correct 11 ms 4568 KB Output is correct
16 Correct 39 ms 4588 KB Output is correct
17 Correct 19 ms 4588 KB Output is correct
18 Correct 28 ms 4588 KB Output is correct
19 Correct 12 ms 4588 KB Output is correct
20 Correct 14 ms 4588 KB Output is correct
21 Correct 38 ms 4588 KB Output is correct
22 Correct 37 ms 4588 KB Output is correct
23 Correct 37 ms 4588 KB Output is correct
24 Correct 12 ms 4588 KB Output is correct
25 Correct 49 ms 4588 KB Output is correct
26 Correct 73 ms 4588 KB Output is correct
27 Correct 27 ms 4588 KB Output is correct
28 Correct 35 ms 4588 KB Output is correct
29 Correct 107 ms 4588 KB Output is correct
30 Correct 28 ms 4588 KB Output is correct
31 Correct 56 ms 4588 KB Output is correct
32 Correct 11 ms 4588 KB Output is correct
33 Correct 105 ms 4588 KB Output is correct
34 Correct 164 ms 4588 KB Output is correct
35 Correct 27 ms 4588 KB Output is correct
36 Correct 162 ms 4588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 4588 KB Output is correct
2 Correct 35 ms 4588 KB Output is correct
3 Correct 12 ms 4588 KB Output is correct
4 Correct 27 ms 4588 KB Output is correct
5 Correct 12 ms 4588 KB Output is correct
6 Correct 118 ms 4588 KB Output is correct
7 Correct 28 ms 4588 KB Output is correct
8 Correct 28 ms 4588 KB Output is correct
9 Correct 29 ms 4588 KB Output is correct
10 Correct 28 ms 4588 KB Output is correct
11 Correct 11 ms 4588 KB Output is correct
12 Correct 27 ms 4588 KB Output is correct
13 Correct 144 ms 4588 KB Output is correct
14 Correct 19 ms 4588 KB Output is correct
15 Correct 12 ms 4588 KB Output is correct
16 Correct 40 ms 4588 KB Output is correct
17 Correct 19 ms 4588 KB Output is correct
18 Correct 28 ms 4588 KB Output is correct
19 Correct 12 ms 4604 KB Output is correct
20 Correct 12 ms 4604 KB Output is correct
21 Correct 36 ms 4604 KB Output is correct
22 Correct 34 ms 4604 KB Output is correct
23 Correct 36 ms 4604 KB Output is correct
24 Correct 12 ms 4604 KB Output is correct
25 Correct 56 ms 4604 KB Output is correct
26 Correct 79 ms 4604 KB Output is correct
27 Correct 158 ms 4604 KB Output is correct
28 Correct 81 ms 4604 KB Output is correct
29 Correct 52 ms 4604 KB Output is correct
30 Correct 159 ms 4604 KB Output is correct
31 Correct 189 ms 4604 KB Output is correct
32 Correct 194 ms 4604 KB Output is correct
33 Correct 12 ms 4604 KB Output is correct
34 Correct 188 ms 4608 KB Output is correct
35 Correct 166 ms 4608 KB Output is correct
36 Correct 97 ms 4608 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 4608 KB Output is correct
2 Correct 37 ms 4608 KB Output is correct
3 Correct 12 ms 4608 KB Output is correct
4 Correct 28 ms 4608 KB Output is correct
5 Correct 12 ms 4608 KB Output is correct
6 Correct 123 ms 4608 KB Output is correct
7 Correct 28 ms 4608 KB Output is correct
8 Correct 28 ms 4608 KB Output is correct
9 Correct 27 ms 4608 KB Output is correct
10 Correct 29 ms 4608 KB Output is correct
11 Correct 12 ms 4608 KB Output is correct
12 Correct 28 ms 4608 KB Output is correct
13 Correct 139 ms 4608 KB Output is correct
14 Correct 169 ms 4608 KB Output is correct
15 Correct 87 ms 4608 KB Output is correct
16 Correct 46 ms 4608 KB Output is correct
17 Correct 167 ms 4608 KB Output is correct
18 Correct 188 ms 4608 KB Output is correct
19 Correct 189 ms 4608 KB Output is correct
20 Correct 12 ms 4608 KB Output is correct
21 Correct 194 ms 4608 KB Output is correct
22 Correct 162 ms 4608 KB Output is correct
23 Correct 85 ms 4608 KB Output is correct
24 Correct 187 ms 4608 KB Output is correct
25 Correct 96 ms 4608 KB Output is correct
26 Correct 277 ms 4608 KB Output is correct
27 Execution timed out 1016 ms 4608 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 4608 KB Output is correct
2 Correct 39 ms 4608 KB Output is correct
3 Correct 12 ms 4608 KB Output is correct
4 Correct 26 ms 4608 KB Output is correct
5 Correct 13 ms 4608 KB Output is correct
6 Correct 121 ms 4608 KB Output is correct
7 Correct 28 ms 4608 KB Output is correct
8 Correct 28 ms 4608 KB Output is correct
9 Correct 26 ms 4608 KB Output is correct
10 Correct 27 ms 4608 KB Output is correct
11 Correct 12 ms 4608 KB Output is correct
12 Correct 27 ms 4608 KB Output is correct
13 Correct 143 ms 4608 KB Output is correct
14 Correct 20 ms 4608 KB Output is correct
15 Correct 12 ms 4608 KB Output is correct
16 Correct 36 ms 4608 KB Output is correct
17 Correct 19 ms 4608 KB Output is correct
18 Correct 28 ms 4608 KB Output is correct
19 Correct 13 ms 4608 KB Output is correct
20 Correct 12 ms 4608 KB Output is correct
21 Correct 35 ms 4608 KB Output is correct
22 Correct 36 ms 4608 KB Output is correct
23 Correct 35 ms 4608 KB Output is correct
24 Correct 12 ms 4608 KB Output is correct
25 Correct 52 ms 4608 KB Output is correct
26 Correct 75 ms 4608 KB Output is correct
27 Correct 28 ms 4608 KB Output is correct
28 Correct 36 ms 4608 KB Output is correct
29 Correct 110 ms 4608 KB Output is correct
30 Correct 28 ms 4608 KB Output is correct
31 Correct 62 ms 4608 KB Output is correct
32 Correct 12 ms 4608 KB Output is correct
33 Correct 106 ms 4608 KB Output is correct
34 Correct 164 ms 4608 KB Output is correct
35 Correct 30 ms 4608 KB Output is correct
36 Correct 170 ms 4608 KB Output is correct
37 Correct 163 ms 4608 KB Output is correct
38 Correct 85 ms 4608 KB Output is correct
39 Correct 44 ms 4608 KB Output is correct
40 Correct 160 ms 4608 KB Output is correct
41 Correct 191 ms 4608 KB Output is correct
42 Correct 175 ms 4608 KB Output is correct
43 Correct 12 ms 4608 KB Output is correct
44 Correct 193 ms 4608 KB Output is correct
45 Correct 161 ms 4608 KB Output is correct
46 Correct 86 ms 4608 KB Output is correct
47 Correct 193 ms 4608 KB Output is correct
48 Correct 98 ms 4660 KB Output is correct
49 Correct 272 ms 4660 KB Output is correct
50 Execution timed out 1012 ms 4660 KB Time limit exceeded
51 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 4660 KB Output is correct
2 Correct 37 ms 4660 KB Output is correct
3 Correct 13 ms 4660 KB Output is correct
4 Correct 29 ms 4660 KB Output is correct
5 Correct 12 ms 4660 KB Output is correct
6 Correct 124 ms 4668 KB Output is correct
7 Correct 26 ms 4668 KB Output is correct
8 Correct 26 ms 4668 KB Output is correct
9 Correct 28 ms 4668 KB Output is correct
10 Correct 29 ms 4668 KB Output is correct
11 Correct 13 ms 4668 KB Output is correct
12 Correct 27 ms 4668 KB Output is correct
13 Correct 143 ms 4668 KB Output is correct
14 Correct 27 ms 4668 KB Output is correct
15 Correct 36 ms 4668 KB Output is correct
16 Correct 106 ms 4668 KB Output is correct
17 Correct 28 ms 4668 KB Output is correct
18 Correct 65 ms 4668 KB Output is correct
19 Correct 12 ms 4668 KB Output is correct
20 Correct 112 ms 4668 KB Output is correct
21 Correct 172 ms 4668 KB Output is correct
22 Correct 29 ms 4668 KB Output is correct
23 Correct 166 ms 4668 KB Output is correct
24 Correct 171 ms 4668 KB Output is correct
25 Correct 89 ms 4668 KB Output is correct
26 Correct 47 ms 4668 KB Output is correct
27 Correct 173 ms 4668 KB Output is correct
28 Correct 191 ms 4668 KB Output is correct
29 Correct 187 ms 4668 KB Output is correct
30 Correct 14 ms 4668 KB Output is correct
31 Correct 189 ms 4668 KB Output is correct
32 Correct 158 ms 4668 KB Output is correct
33 Correct 94 ms 4668 KB Output is correct
34 Correct 193 ms 4668 KB Output is correct
35 Correct 99 ms 4668 KB Output is correct
36 Correct 258 ms 4668 KB Output is correct
37 Execution timed out 1057 ms 4668 KB Time limit exceeded
38 Halted 0 ms 0 KB -