답안 #582934

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
582934 2022-06-24T15:27:10 Z Justin1 Bali Sculptures (APIO15_sculpture) C++14
16 / 100
1000 ms 4180 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll n,m,k,x,y,z;
ll a,b;
bool dp[105][2005][105];
ll ar[105];

signed main() {
	cin >> n >> a >> b;
	for (int i = 1; i <= n; i++) cin >> ar[i];
	ll mxval = 0;
	for (int i = 1; i <= n; i++) mxval = max(mxval,ar[i]);
	for (int i = 1; i <= n; i++) ar[i] += ar[i-1];
	dp[0][0][0] = 1;
	for (int i = 1; i <= n; i++) { //pos
		for (int j = n; j >= 1; j--) { //st pos
			for (int k = n; k >= 1; k--) { //groups
				for (int l = 0; l <= n*mxval; l++) { //total or
					if (dp[j-1][l][k-1]) dp[i][l|(ar[i]-ar[j-1])][k] = 1;
				}
			}
		}
	}
	for (int i = 0; i <= mxval*n; i++) {
		for (int j = a; j <= b; j++) {
			if (dp[n][i][j]) {
				cout << i << "\n";
				return 0;
			}
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 2 ms 468 KB Output is correct
22 Correct 2 ms 468 KB Output is correct
23 Correct 2 ms 560 KB Output is correct
24 Correct 2 ms 468 KB Output is correct
25 Correct 2 ms 340 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Runtime error 4 ms 468 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 280 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 3 ms 340 KB Output is correct
22 Correct 2 ms 488 KB Output is correct
23 Correct 2 ms 468 KB Output is correct
24 Correct 4 ms 468 KB Output is correct
25 Correct 2 ms 340 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 4 ms 468 KB Output is correct
28 Correct 4 ms 468 KB Output is correct
29 Correct 28 ms 828 KB Output is correct
30 Correct 28 ms 860 KB Output is correct
31 Correct 53 ms 1552 KB Output is correct
32 Correct 63 ms 1680 KB Output is correct
33 Correct 58 ms 1832 KB Output is correct
34 Correct 52 ms 972 KB Output is correct
35 Correct 51 ms 1148 KB Output is correct
36 Correct 54 ms 1128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 2 ms 468 KB Output is correct
15 Correct 4 ms 468 KB Output is correct
16 Correct 19 ms 832 KB Output is correct
17 Correct 26 ms 792 KB Output is correct
18 Correct 56 ms 1524 KB Output is correct
19 Correct 52 ms 1760 KB Output is correct
20 Correct 55 ms 1660 KB Output is correct
21 Correct 56 ms 1004 KB Output is correct
22 Correct 69 ms 1152 KB Output is correct
23 Correct 49 ms 1020 KB Output is correct
24 Correct 109 ms 1592 KB Output is correct
25 Correct 307 ms 2448 KB Output is correct
26 Correct 621 ms 3520 KB Output is correct
27 Execution timed out 1099 ms 4180 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 3 ms 344 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 3 ms 468 KB Output is correct
11 Correct 4 ms 468 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 3 ms 340 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 2 ms 468 KB Output is correct
22 Correct 3 ms 624 KB Output is correct
23 Correct 3 ms 468 KB Output is correct
24 Correct 2 ms 468 KB Output is correct
25 Correct 2 ms 416 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Runtime error 4 ms 468 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Runtime error 5 ms 340 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -