답안 #338798

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
338798 2020-12-23T23:01:29 Z ogibogi2004 Bali Sculptures (APIO15_sculpture) C++14
21 / 100
1000 ms 5100 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll MAXN=2048;
vector<pair<ll,ll> >g[MAXN];
ll n,a,b,cur;
ll y[MAXN];
bool dp[MAXN][MAXN];
bool ok(ll idx)
{
	//if(idx==1)cout<<idx<<endl;
	for(int i=0;i<=n+1;i++)
	{
		for(int j=0;j<=n+1;j++)
		{
			dp[i][j]=0;
		}
	}
	dp[0][0]=1;
	dp[1][0]=1;
	for(ll i=0;i<=n;i++)
	{
		for(auto xd:g[i])
		{
			if((xd.first|idx)!=idx)continue;
			for(ll j=0;j<=n;j++)
			{
				dp[xd.second+1][j+1]|=dp[i][j];
			}
		}
	}
	for(ll i=a;i<=b;i++)
	{
		if(dp[n+1][i])return 1;
	}
	return 0;
}
int main()
{
	cin>>n>>a>>b;
	for(ll i=1;i<=n;i++)
	{
		cin>>y[i];
	}
	for(ll i=0;i<=n;i++)
	{
		ll sum=0;
		for(ll j=i;j<=n;j++)
		{
			sum+=y[j];
			g[i].push_back({sum,j});
		}
	}
	cur=(1ll<<61)-1ll;
	for(ll i=60;i>=0;i--)
	{
		if(ok(cur-(1ll<<i)))
		{
			cur-=(1ll<<i);
		}
	}
	cout<<cur<<endl;
return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Incorrect 1 ms 364 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Incorrect 1 ms 364 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 2 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 492 KB Output is correct
16 Correct 3 ms 492 KB Output is correct
17 Correct 4 ms 492 KB Output is correct
18 Correct 5 ms 492 KB Output is correct
19 Correct 5 ms 492 KB Output is correct
20 Correct 6 ms 620 KB Output is correct
21 Correct 5 ms 492 KB Output is correct
22 Correct 7 ms 492 KB Output is correct
23 Correct 8 ms 492 KB Output is correct
24 Correct 6 ms 492 KB Output is correct
25 Correct 11 ms 492 KB Output is correct
26 Correct 18 ms 620 KB Output is correct
27 Correct 25 ms 620 KB Output is correct
28 Correct 34 ms 748 KB Output is correct
29 Correct 33 ms 748 KB Output is correct
30 Correct 34 ms 748 KB Output is correct
31 Correct 41 ms 748 KB Output is correct
32 Correct 41 ms 748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Incorrect 1 ms 364 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 492 KB Output is correct
26 Correct 4 ms 492 KB Output is correct
27 Correct 4 ms 512 KB Output is correct
28 Correct 5 ms 492 KB Output is correct
29 Correct 6 ms 492 KB Output is correct
30 Correct 6 ms 492 KB Output is correct
31 Correct 6 ms 492 KB Output is correct
32 Correct 5 ms 492 KB Output is correct
33 Correct 6 ms 492 KB Output is correct
34 Correct 6 ms 492 KB Output is correct
35 Correct 13 ms 636 KB Output is correct
36 Correct 17 ms 620 KB Output is correct
37 Correct 26 ms 620 KB Output is correct
38 Correct 41 ms 752 KB Output is correct
39 Correct 33 ms 748 KB Output is correct
40 Correct 36 ms 768 KB Output is correct
41 Correct 33 ms 876 KB Output is correct
42 Correct 33 ms 748 KB Output is correct
43 Correct 4 ms 492 KB Output is correct
44 Correct 10 ms 620 KB Output is correct
45 Correct 14 ms 620 KB Output is correct
46 Correct 18 ms 748 KB Output is correct
47 Correct 19 ms 748 KB Output is correct
48 Correct 18 ms 748 KB Output is correct
49 Correct 20 ms 748 KB Output is correct
50 Correct 20 ms 748 KB Output is correct
51 Correct 26 ms 748 KB Output is correct
52 Execution timed out 1085 ms 5100 KB Time limit exceeded
53 Halted 0 ms 0 KB -