답안 #113134

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
113134 2019-05-23T21:05:50 Z ioilolcom Bali Sculptures (APIO15_sculpture) C++14
21 / 100
81 ms 512 KB
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
vector<ll> v;
int n;
const int N=107;
ll pre[N];
ll dp[N][N];
ll query(int l,int r){
	return pre[r]-pre[l-1];
}
ll solve(int idx,int k){
	if(idx==n+1) {
		if(k==0) {
			return 0;
		}
		return 1e13;
	}
	if(dp[idx][k]!=-1) return dp[idx][k];
	ll ans=1e18;
	for(int j=idx; j<=n; j++) {
		ans=min(ans,query(idx,j) | solve(j+1,k-1));
	}
	return dp[idx][k]=ans;
}
int main()
{
	ios_base:: sync_with_stdio(false); cin.tie(0);
	cin>>n;
	int a,b;
	cin>>a>>b;
	v.resize(n+1);
	for(int i=1; i<=n; i++) {
		cin>>v[i];
		pre[i]=pre[i-1]+v[i];
	}

	ll ans=1e17;
	for(int i=a; i<=b; i++) {
		memset(dp,-1,sizeof dp);
		ans=min(ans,solve(1,i));
	}
	cout<<ans<<endl;

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 512 KB Output is correct
21 Incorrect 2 ms 384 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 512 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 512 KB Output is correct
21 Incorrect 2 ms 384 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 432 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 512 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 2 ms 512 KB Output is correct
21 Correct 4 ms 512 KB Output is correct
22 Correct 4 ms 384 KB Output is correct
23 Correct 3 ms 512 KB Output is correct
24 Correct 4 ms 384 KB Output is correct
25 Correct 4 ms 384 KB Output is correct
26 Correct 11 ms 512 KB Output is correct
27 Correct 34 ms 384 KB Output is correct
28 Correct 79 ms 384 KB Output is correct
29 Correct 80 ms 384 KB Output is correct
30 Correct 3 ms 512 KB Output is correct
31 Correct 38 ms 384 KB Output is correct
32 Correct 60 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 512 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 512 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Incorrect 2 ms 384 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 356 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 512 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 512 KB Output is correct
19 Correct 2 ms 512 KB Output is correct
20 Correct 2 ms 512 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 512 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 3 ms 512 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 4 ms 384 KB Output is correct
29 Correct 4 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 4 ms 384 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 3 ms 384 KB Output is correct
34 Correct 4 ms 384 KB Output is correct
35 Correct 4 ms 384 KB Output is correct
36 Correct 10 ms 384 KB Output is correct
37 Correct 34 ms 512 KB Output is correct
38 Correct 80 ms 464 KB Output is correct
39 Correct 81 ms 384 KB Output is correct
40 Correct 4 ms 512 KB Output is correct
41 Correct 41 ms 504 KB Output is correct
42 Correct 60 ms 384 KB Output is correct
43 Incorrect 4 ms 384 KB Output isn't correct
44 Halted 0 ms 0 KB -