Submission #338796

# Submission time Handle Problem Language Result Execution time Memory
338796 2020-12-23T22:56:58 Z ogibogi2004 Bali Sculptures (APIO15_sculpture) C++14
21 / 100
1000 ms 5248 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;
	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;
}
# Verdict Execution time Memory 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 512 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 Incorrect 1 ms 364 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 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 504 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 512 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 -
# Verdict Execution time Memory 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 364 KB Output is correct
15 Correct 1 ms 492 KB Output is correct
16 Correct 2 ms 492 KB Output is correct
17 Correct 3 ms 492 KB Output is correct
18 Correct 4 ms 492 KB Output is correct
19 Correct 4 ms 492 KB Output is correct
20 Correct 4 ms 492 KB Output is correct
21 Correct 5 ms 492 KB Output is correct
22 Correct 4 ms 492 KB Output is correct
23 Correct 4 ms 492 KB Output is correct
24 Correct 4 ms 492 KB Output is correct
25 Correct 8 ms 492 KB Output is correct
26 Correct 12 ms 620 KB Output is correct
27 Correct 18 ms 620 KB Output is correct
28 Correct 23 ms 748 KB Output is correct
29 Correct 23 ms 748 KB Output is correct
30 Correct 31 ms 748 KB Output is correct
31 Correct 23 ms 748 KB Output is correct
32 Correct 23 ms 748 KB Output is correct
# Verdict Execution time Memory 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 380 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 384 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 -
# Verdict Execution time Memory 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 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 364 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 2 ms 512 KB Output is correct
27 Correct 3 ms 492 KB Output is correct
28 Correct 4 ms 492 KB Output is correct
29 Correct 4 ms 492 KB Output is correct
30 Correct 4 ms 492 KB Output is correct
31 Correct 7 ms 492 KB Output is correct
32 Correct 4 ms 492 KB Output is correct
33 Correct 4 ms 492 KB Output is correct
34 Correct 4 ms 492 KB Output is correct
35 Correct 8 ms 620 KB Output is correct
36 Correct 12 ms 620 KB Output is correct
37 Correct 18 ms 620 KB Output is correct
38 Correct 23 ms 876 KB Output is correct
39 Correct 22 ms 748 KB Output is correct
40 Correct 24 ms 748 KB Output is correct
41 Correct 22 ms 748 KB Output is correct
42 Correct 22 ms 748 KB Output is correct
43 Correct 3 ms 492 KB Output is correct
44 Correct 7 ms 620 KB Output is correct
45 Correct 10 ms 620 KB Output is correct
46 Correct 13 ms 748 KB Output is correct
47 Correct 12 ms 748 KB Output is correct
48 Correct 13 ms 748 KB Output is correct
49 Correct 14 ms 748 KB Output is correct
50 Correct 14 ms 748 KB Output is correct
51 Correct 13 ms 748 KB Output is correct
52 Execution timed out 1089 ms 5248 KB Time limit exceeded
53 Halted 0 ms 0 KB -