Submission #41367

# Submission time Handle Problem Language Result Execution time Memory
41367 2018-02-17T05:41:13 Z RockyB Bali Sculptures (APIO15_sculpture) C++14
9 / 100
1000 ms 984 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];

ll ans = linf;
void rec(int v = 1, int done = 0, ll cost = 0) {
	if (done > B) return;
	if (v > n) {
		if (A <= done && done <= B) {
			ans = min(ans, cost);
		}
		return;
	}
	ll sum = 0;
	for (int i = v; i <= n; i++) {
		sum += a[i];
		rec(i + 1, done + 1, cost | sum);
	}
}
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];
	}
	rec();
	cout << ans;
	ioi
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 552 KB Output is correct
4 Correct 1 ms 552 KB Output is correct
5 Correct 2 ms 552 KB Output is correct
6 Correct 2 ms 552 KB Output is correct
7 Correct 2 ms 552 KB Output is correct
8 Correct 2 ms 552 KB Output is correct
9 Correct 2 ms 556 KB Output is correct
10 Correct 2 ms 612 KB Output is correct
11 Correct 2 ms 616 KB Output is correct
12 Correct 2 ms 620 KB Output is correct
13 Correct 6 ms 624 KB Output is correct
14 Correct 2 ms 648 KB Output is correct
15 Correct 2 ms 652 KB Output is correct
16 Correct 2 ms 656 KB Output is correct
17 Correct 2 ms 660 KB Output is correct
18 Correct 2 ms 664 KB Output is correct
19 Correct 2 ms 668 KB Output is correct
20 Correct 2 ms 672 KB Output is correct
21 Correct 2 ms 676 KB Output is correct
22 Correct 3 ms 680 KB Output is correct
23 Correct 2 ms 688 KB Output is correct
24 Correct 2 ms 692 KB Output is correct
25 Correct 2 ms 696 KB Output is correct
26 Correct 6 ms 700 KB Output is correct
27 Correct 1 ms 704 KB Output is correct
28 Correct 2 ms 708 KB Output is correct
29 Correct 2 ms 728 KB Output is correct
30 Correct 2 ms 732 KB Output is correct
31 Correct 3 ms 736 KB Output is correct
32 Correct 2 ms 740 KB Output is correct
33 Correct 6 ms 744 KB Output is correct
34 Correct 5 ms 748 KB Output is correct
35 Correct 2 ms 752 KB Output is correct
36 Correct 5 ms 756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 1 ms 760 KB Output is correct
3 Correct 1 ms 760 KB Output is correct
4 Correct 2 ms 764 KB Output is correct
5 Correct 2 ms 768 KB Output is correct
6 Correct 2 ms 772 KB Output is correct
7 Correct 2 ms 776 KB Output is correct
8 Correct 2 ms 896 KB Output is correct
9 Correct 2 ms 896 KB Output is correct
10 Correct 2 ms 896 KB Output is correct
11 Correct 2 ms 896 KB Output is correct
12 Correct 2 ms 912 KB Output is correct
13 Correct 6 ms 912 KB Output is correct
14 Correct 2 ms 912 KB Output is correct
15 Correct 2 ms 912 KB Output is correct
16 Correct 2 ms 940 KB Output is correct
17 Correct 1 ms 940 KB Output is correct
18 Correct 2 ms 940 KB Output is correct
19 Correct 2 ms 940 KB Output is correct
20 Correct 1 ms 940 KB Output is correct
21 Correct 3 ms 940 KB Output is correct
22 Correct 2 ms 948 KB Output is correct
23 Correct 2 ms 948 KB Output is correct
24 Correct 2 ms 956 KB Output is correct
25 Correct 2 ms 956 KB Output is correct
26 Correct 5 ms 956 KB Output is correct
27 Correct 9 ms 956 KB Output is correct
28 Correct 42 ms 956 KB Output is correct
29 Correct 14 ms 956 KB Output is correct
30 Execution timed out 1060 ms 956 KB Time limit exceeded
31 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 956 KB Output is correct
2 Correct 1 ms 972 KB Output is correct
3 Correct 1 ms 972 KB Output is correct
4 Correct 2 ms 972 KB Output is correct
5 Correct 2 ms 972 KB Output is correct
6 Correct 2 ms 972 KB Output is correct
7 Correct 2 ms 972 KB Output is correct
8 Correct 2 ms 972 KB Output is correct
9 Correct 1 ms 972 KB Output is correct
10 Correct 2 ms 972 KB Output is correct
11 Correct 2 ms 972 KB Output is correct
12 Correct 1 ms 972 KB Output is correct
13 Correct 5 ms 972 KB Output is correct
14 Correct 9 ms 972 KB Output is correct
15 Correct 46 ms 972 KB Output is correct
16 Correct 13 ms 972 KB Output is correct
17 Execution timed out 1056 ms 972 KB Time limit exceeded
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 972 KB Output is correct
2 Correct 2 ms 980 KB Output is correct
3 Correct 2 ms 980 KB Output is correct
4 Correct 2 ms 980 KB Output is correct
5 Correct 2 ms 980 KB Output is correct
6 Correct 2 ms 984 KB Output is correct
7 Correct 1 ms 984 KB Output is correct
8 Correct 2 ms 984 KB Output is correct
9 Correct 2 ms 984 KB Output is correct
10 Correct 1 ms 984 KB Output is correct
11 Correct 1 ms 984 KB Output is correct
12 Correct 1 ms 984 KB Output is correct
13 Correct 5 ms 984 KB Output is correct
14 Correct 1 ms 984 KB Output is correct
15 Correct 1 ms 984 KB Output is correct
16 Correct 2 ms 984 KB Output is correct
17 Correct 2 ms 984 KB Output is correct
18 Correct 2 ms 984 KB Output is correct
19 Correct 2 ms 984 KB Output is correct
20 Correct 2 ms 984 KB Output is correct
21 Correct 2 ms 984 KB Output is correct
22 Correct 2 ms 984 KB Output is correct
23 Correct 2 ms 984 KB Output is correct
24 Correct 1 ms 984 KB Output is correct
25 Correct 2 ms 984 KB Output is correct
26 Correct 5 ms 984 KB Output is correct
27 Correct 2 ms 984 KB Output is correct
28 Correct 1 ms 984 KB Output is correct
29 Correct 1 ms 984 KB Output is correct
30 Correct 2 ms 984 KB Output is correct
31 Correct 2 ms 984 KB Output is correct
32 Correct 2 ms 984 KB Output is correct
33 Correct 5 ms 984 KB Output is correct
34 Correct 6 ms 984 KB Output is correct
35 Correct 2 ms 984 KB Output is correct
36 Correct 5 ms 984 KB Output is correct
37 Correct 8 ms 984 KB Output is correct
38 Correct 41 ms 984 KB Output is correct
39 Correct 13 ms 984 KB Output is correct
40 Execution timed out 1074 ms 984 KB Time limit exceeded
41 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 984 KB Output is correct
2 Correct 2 ms 984 KB Output is correct
3 Correct 1 ms 984 KB Output is correct
4 Correct 1 ms 984 KB Output is correct
5 Correct 2 ms 984 KB Output is correct
6 Correct 2 ms 984 KB Output is correct
7 Correct 1 ms 984 KB Output is correct
8 Correct 2 ms 984 KB Output is correct
9 Correct 2 ms 984 KB Output is correct
10 Correct 2 ms 984 KB Output is correct
11 Correct 2 ms 984 KB Output is correct
12 Correct 2 ms 984 KB Output is correct
13 Correct 6 ms 984 KB Output is correct
14 Correct 2 ms 984 KB Output is correct
15 Correct 2 ms 984 KB Output is correct
16 Correct 1 ms 984 KB Output is correct
17 Correct 2 ms 984 KB Output is correct
18 Correct 2 ms 984 KB Output is correct
19 Correct 1 ms 984 KB Output is correct
20 Correct 8 ms 984 KB Output is correct
21 Correct 5 ms 984 KB Output is correct
22 Correct 2 ms 984 KB Output is correct
23 Correct 6 ms 984 KB Output is correct
24 Correct 8 ms 984 KB Output is correct
25 Correct 42 ms 984 KB Output is correct
26 Correct 13 ms 984 KB Output is correct
27 Execution timed out 1067 ms 984 KB Time limit exceeded
28 Halted 0 ms 0 KB -