Submission #338792

# Submission time Handle Problem Language Result Execution time Memory
338792 2020-12-23T22:46:58 Z ogibogi2004 Bali Sculptures (APIO15_sculpture) C++14
21 / 100
36 ms 4716 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;
	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	for(int i=0;i<=n;i++)
	{
		for(auto xd:g[i])
		{
			if((xd.first|idx)!=idx)continue;
			for(int j=0;j<=n;j++)
			{
				dp[xd.second+1][j+1]|=dp[i][j];
			}
		}
	}
	for(int 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(int i=0;i<=n;i++)
	{
		int sum=0;
		for(int j=i;j<=n;j++)
		{
			sum+=y[j];
			g[i].push_back({sum,j});
		}
	}
	cur=(1ll<<51)-1;
	for(ll i=50;i>=0;i--)
	{
		if(ok(cur-(1ll<<i)))
		{
			cur-=(1ll<<i);
		}
	}
	cout<<cur<<endl;
return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 11 ms 4460 KB Output is correct
2 Correct 10 ms 4460 KB Output is correct
3 Correct 12 ms 4460 KB Output is correct
4 Correct 10 ms 4460 KB Output is correct
5 Correct 12 ms 4460 KB Output is correct
6 Correct 12 ms 4460 KB Output is correct
7 Correct 11 ms 4460 KB Output is correct
8 Correct 14 ms 4460 KB Output is correct
9 Correct 11 ms 4460 KB Output is correct
10 Correct 12 ms 4460 KB Output is correct
11 Correct 12 ms 4460 KB Output is correct
12 Correct 12 ms 4460 KB Output is correct
13 Correct 11 ms 4460 KB Output is correct
14 Correct 11 ms 4460 KB Output is correct
15 Incorrect 11 ms 4460 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 4460 KB Output is correct
2 Correct 11 ms 4460 KB Output is correct
3 Correct 11 ms 4460 KB Output is correct
4 Correct 11 ms 4460 KB Output is correct
5 Correct 11 ms 4460 KB Output is correct
6 Correct 11 ms 4588 KB Output is correct
7 Correct 11 ms 4460 KB Output is correct
8 Correct 12 ms 4460 KB Output is correct
9 Correct 11 ms 4460 KB Output is correct
10 Correct 12 ms 4460 KB Output is correct
11 Correct 11 ms 4460 KB Output is correct
12 Correct 11 ms 4460 KB Output is correct
13 Correct 12 ms 4460 KB Output is correct
14 Correct 12 ms 4460 KB Output is correct
15 Incorrect 10 ms 4460 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 4460 KB Output is correct
2 Correct 11 ms 4460 KB Output is correct
3 Correct 10 ms 4460 KB Output is correct
4 Correct 12 ms 4460 KB Output is correct
5 Correct 11 ms 4480 KB Output is correct
6 Correct 11 ms 4460 KB Output is correct
7 Correct 11 ms 4460 KB Output is correct
8 Correct 11 ms 4480 KB Output is correct
9 Correct 11 ms 4460 KB Output is correct
10 Correct 11 ms 4460 KB Output is correct
11 Correct 11 ms 4472 KB Output is correct
12 Correct 11 ms 4460 KB Output is correct
13 Correct 11 ms 4460 KB Output is correct
14 Correct 11 ms 4460 KB Output is correct
15 Correct 11 ms 4480 KB Output is correct
16 Correct 12 ms 4460 KB Output is correct
17 Correct 13 ms 4460 KB Output is correct
18 Correct 14 ms 4460 KB Output is correct
19 Correct 15 ms 4608 KB Output is correct
20 Correct 14 ms 4460 KB Output is correct
21 Correct 15 ms 4588 KB Output is correct
22 Correct 14 ms 4480 KB Output is correct
23 Correct 14 ms 4460 KB Output is correct
24 Correct 14 ms 4460 KB Output is correct
25 Correct 17 ms 4460 KB Output is correct
26 Correct 20 ms 4588 KB Output is correct
27 Correct 29 ms 4588 KB Output is correct
28 Correct 30 ms 4588 KB Output is correct
29 Correct 29 ms 4588 KB Output is correct
30 Correct 36 ms 4588 KB Output is correct
31 Correct 33 ms 4716 KB Output is correct
32 Correct 30 ms 4588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 4460 KB Output is correct
2 Correct 11 ms 4460 KB Output is correct
3 Correct 11 ms 4460 KB Output is correct
4 Correct 12 ms 4588 KB Output is correct
5 Correct 11 ms 4460 KB Output is correct
6 Correct 13 ms 4460 KB Output is correct
7 Correct 12 ms 4460 KB Output is correct
8 Correct 11 ms 4460 KB Output is correct
9 Correct 10 ms 4460 KB Output is correct
10 Correct 11 ms 4460 KB Output is correct
11 Correct 11 ms 4460 KB Output is correct
12 Correct 11 ms 4460 KB Output is correct
13 Correct 11 ms 4460 KB Output is correct
14 Correct 12 ms 4460 KB Output is correct
15 Incorrect 12 ms 4460 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 4460 KB Output is correct
2 Correct 11 ms 4460 KB Output is correct
3 Correct 11 ms 4460 KB Output is correct
4 Correct 11 ms 4480 KB Output is correct
5 Correct 11 ms 4460 KB Output is correct
6 Correct 12 ms 4460 KB Output is correct
7 Correct 11 ms 4460 KB Output is correct
8 Correct 11 ms 4460 KB Output is correct
9 Correct 11 ms 4460 KB Output is correct
10 Correct 10 ms 4460 KB Output is correct
11 Correct 11 ms 4460 KB Output is correct
12 Correct 12 ms 4460 KB Output is correct
13 Correct 11 ms 4460 KB Output is correct
14 Correct 11 ms 4524 KB Output is correct
15 Incorrect 11 ms 4460 KB Output isn't correct
16 Halted 0 ms 0 KB -