답안 #41368

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
41368 2018-02-17T05:41:56 Z RockyB Bali Sculptures (APIO15_sculpture) C++14
9 / 100
900 ms 860 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);
		}
		if (clock() / (double)CLOCKS_PER_SEC > 0.9) cout << ans, ioi
		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
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 248 KB Output is correct
2 Correct 2 ms 352 KB Output is correct
3 Correct 2 ms 404 KB Output is correct
4 Correct 2 ms 524 KB Output is correct
5 Correct 2 ms 532 KB Output is correct
6 Correct 9 ms 648 KB Output is correct
7 Correct 2 ms 648 KB Output is correct
8 Correct 2 ms 648 KB Output is correct
9 Correct 2 ms 648 KB Output is correct
10 Correct 2 ms 648 KB Output is correct
11 Correct 2 ms 716 KB Output is correct
12 Correct 2 ms 716 KB Output is correct
13 Correct 265 ms 716 KB Output is correct
14 Correct 2 ms 716 KB Output is correct
15 Correct 2 ms 716 KB Output is correct
16 Correct 1 ms 716 KB Output is correct
17 Correct 2 ms 716 KB Output is correct
18 Correct 2 ms 716 KB Output is correct
19 Correct 11 ms 716 KB Output is correct
20 Correct 2 ms 716 KB Output is correct
21 Correct 24 ms 752 KB Output is correct
22 Correct 23 ms 752 KB Output is correct
23 Correct 25 ms 752 KB Output is correct
24 Correct 1 ms 752 KB Output is correct
25 Correct 23 ms 752 KB Output is correct
26 Correct 260 ms 752 KB Output is correct
27 Correct 2 ms 752 KB Output is correct
28 Correct 2 ms 752 KB Output is correct
29 Correct 4 ms 752 KB Output is correct
30 Correct 2 ms 752 KB Output is correct
31 Correct 24 ms 752 KB Output is correct
32 Correct 2 ms 752 KB Output is correct
33 Correct 234 ms 752 KB Output is correct
34 Correct 262 ms 752 KB Output is correct
35 Correct 2 ms 752 KB Output is correct
36 Correct 257 ms 752 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 752 KB Output is correct
2 Correct 1 ms 752 KB Output is correct
3 Correct 1 ms 752 KB Output is correct
4 Correct 2 ms 752 KB Output is correct
5 Correct 1 ms 752 KB Output is correct
6 Correct 9 ms 752 KB Output is correct
7 Correct 2 ms 752 KB Output is correct
8 Correct 2 ms 752 KB Output is correct
9 Correct 2 ms 752 KB Output is correct
10 Correct 2 ms 752 KB Output is correct
11 Correct 1 ms 752 KB Output is correct
12 Correct 2 ms 752 KB Output is correct
13 Correct 244 ms 752 KB Output is correct
14 Correct 1 ms 752 KB Output is correct
15 Correct 1 ms 752 KB Output is correct
16 Correct 1 ms 752 KB Output is correct
17 Correct 1 ms 752 KB Output is correct
18 Correct 1 ms 752 KB Output is correct
19 Correct 9 ms 752 KB Output is correct
20 Correct 1 ms 752 KB Output is correct
21 Correct 23 ms 752 KB Output is correct
22 Correct 23 ms 752 KB Output is correct
23 Correct 22 ms 752 KB Output is correct
24 Correct 1 ms 752 KB Output is correct
25 Correct 22 ms 752 KB Output is correct
26 Correct 235 ms 752 KB Output is correct
27 Correct 513 ms 752 KB Output is correct
28 Correct 900 ms 752 KB Output is correct
29 Correct 47 ms 752 KB Output is correct
30 Incorrect 900 ms 752 KB Output isn't correct
31 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 752 KB Output is correct
2 Correct 2 ms 752 KB Output is correct
3 Correct 2 ms 752 KB Output is correct
4 Correct 2 ms 752 KB Output is correct
5 Correct 2 ms 752 KB Output is correct
6 Correct 10 ms 752 KB Output is correct
7 Correct 2 ms 752 KB Output is correct
8 Correct 2 ms 752 KB Output is correct
9 Correct 2 ms 752 KB Output is correct
10 Correct 2 ms 752 KB Output is correct
11 Correct 2 ms 752 KB Output is correct
12 Correct 2 ms 752 KB Output is correct
13 Correct 248 ms 752 KB Output is correct
14 Correct 498 ms 752 KB Output is correct
15 Correct 900 ms 752 KB Output is correct
16 Correct 49 ms 752 KB Output is correct
17 Incorrect 900 ms 752 KB Output isn't correct
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 752 KB Output is correct
2 Correct 1 ms 752 KB Output is correct
3 Correct 2 ms 752 KB Output is correct
4 Correct 2 ms 752 KB Output is correct
5 Correct 2 ms 752 KB Output is correct
6 Correct 9 ms 752 KB Output is correct
7 Correct 1 ms 752 KB Output is correct
8 Correct 1 ms 752 KB Output is correct
9 Correct 1 ms 752 KB Output is correct
10 Correct 2 ms 752 KB Output is correct
11 Correct 1 ms 752 KB Output is correct
12 Correct 1 ms 752 KB Output is correct
13 Correct 255 ms 752 KB Output is correct
14 Correct 1 ms 752 KB Output is correct
15 Correct 1 ms 752 KB Output is correct
16 Correct 2 ms 752 KB Output is correct
17 Correct 1 ms 752 KB Output is correct
18 Correct 1 ms 752 KB Output is correct
19 Correct 9 ms 752 KB Output is correct
20 Correct 1 ms 752 KB Output is correct
21 Correct 22 ms 752 KB Output is correct
22 Correct 22 ms 752 KB Output is correct
23 Correct 22 ms 752 KB Output is correct
24 Correct 1 ms 752 KB Output is correct
25 Correct 23 ms 752 KB Output is correct
26 Correct 232 ms 752 KB Output is correct
27 Correct 1 ms 752 KB Output is correct
28 Correct 1 ms 752 KB Output is correct
29 Correct 3 ms 752 KB Output is correct
30 Correct 2 ms 752 KB Output is correct
31 Correct 23 ms 752 KB Output is correct
32 Correct 1 ms 752 KB Output is correct
33 Correct 241 ms 752 KB Output is correct
34 Correct 257 ms 752 KB Output is correct
35 Correct 2 ms 752 KB Output is correct
36 Correct 255 ms 752 KB Output is correct
37 Correct 496 ms 752 KB Output is correct
38 Correct 900 ms 752 KB Output is correct
39 Correct 51 ms 752 KB Output is correct
40 Incorrect 900 ms 752 KB Output isn't correct
41 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 752 KB Output is correct
2 Correct 1 ms 752 KB Output is correct
3 Correct 1 ms 752 KB Output is correct
4 Correct 1 ms 752 KB Output is correct
5 Correct 1 ms 752 KB Output is correct
6 Correct 10 ms 752 KB Output is correct
7 Correct 1 ms 752 KB Output is correct
8 Correct 1 ms 752 KB Output is correct
9 Correct 2 ms 752 KB Output is correct
10 Correct 1 ms 752 KB Output is correct
11 Correct 1 ms 752 KB Output is correct
12 Correct 2 ms 752 KB Output is correct
13 Correct 251 ms 752 KB Output is correct
14 Correct 2 ms 752 KB Output is correct
15 Correct 2 ms 752 KB Output is correct
16 Correct 4 ms 752 KB Output is correct
17 Correct 1 ms 752 KB Output is correct
18 Correct 30 ms 752 KB Output is correct
19 Correct 2 ms 752 KB Output is correct
20 Correct 244 ms 752 KB Output is correct
21 Correct 254 ms 752 KB Output is correct
22 Correct 1 ms 752 KB Output is correct
23 Correct 247 ms 752 KB Output is correct
24 Correct 520 ms 860 KB Output is correct
25 Correct 900 ms 860 KB Output is correct
26 Correct 49 ms 860 KB Output is correct
27 Incorrect 900 ms 860 KB Output isn't correct
28 Halted 0 ms 0 KB -