답안 #338786

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
338786 2020-12-23T22:27:22 Z ogibogi2004 Bali Sculptures (APIO15_sculpture) C++14
21 / 100
32 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(idx==1)cout<<xd.first<<" "<<(xd.first&(~cur))<<" "<<(1ll<<idx)<<endl;
			if((xd.first&(~cur))>=(1ll<<idx))continue;
			//if(idx==1)cout<<i<<" "<<xd.second<<endl;
			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});
		}
	}
	for(ll i=50;i>=0;i--)
	{
		if(!ok(i))
		{
			cur+=(1ll<<i);
		}
	}
	cout<<cur<<endl;
return 0;
}
# 결과 실행 시간 메모리 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 4460 KB Output is correct
5 Correct 11 ms 4460 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 4460 KB Output is correct
9 Correct 13 ms 4588 KB Output is correct
10 Correct 11 ms 4480 KB Output is correct
11 Correct 13 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 11 ms 4460 KB Output is correct
15 Incorrect 12 ms 4588 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 4460 KB Output is correct
2 Correct 10 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 4588 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 4460 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 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 11 ms 4588 KB Output is correct
15 Incorrect 11 ms 4460 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 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 10 ms 4460 KB Output is correct
5 Correct 11 ms 4460 KB Output is correct
6 Correct 11 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 13 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 11 ms 4460 KB Output is correct
15 Correct 11 ms 4460 KB Output is correct
16 Correct 12 ms 4460 KB Output is correct
17 Correct 13 ms 4460 KB Output is correct
18 Correct 13 ms 4480 KB Output is correct
19 Correct 14 ms 4460 KB Output is correct
20 Correct 15 ms 4460 KB Output is correct
21 Correct 13 ms 4460 KB Output is correct
22 Correct 13 ms 4460 KB Output is correct
23 Correct 16 ms 4460 KB Output is correct
24 Correct 14 ms 4480 KB Output is correct
25 Correct 17 ms 4460 KB Output is correct
26 Correct 21 ms 4588 KB Output is correct
27 Correct 28 ms 4588 KB Output is correct
28 Correct 30 ms 4588 KB Output is correct
29 Correct 30 ms 4716 KB Output is correct
30 Correct 32 ms 4588 KB Output is correct
31 Correct 30 ms 4588 KB Output is correct
32 Correct 31 ms 4588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 4460 KB Output is correct
2 Correct 10 ms 4460 KB Output is correct
3 Correct 11 ms 4460 KB Output is correct
4 Correct 12 ms 4460 KB Output is correct
5 Correct 11 ms 4460 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 4460 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 4460 KB Output is correct
12 Correct 11 ms 4460 KB Output is correct
13 Correct 12 ms 4532 KB Output is correct
14 Correct 10 ms 4460 KB Output is correct
15 Incorrect 10 ms 4460 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 4460 KB Output is correct
5 Correct 11 ms 4460 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 4460 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 4460 KB Output is correct
12 Correct 11 ms 4460 KB Output is correct
13 Correct 11 ms 4460 KB Output is correct
14 Incorrect 11 ms 4460 KB Output isn't correct
15 Halted 0 ms 0 KB -