답안 #338795

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
338795 2020-12-23T22:51:33 Z ogibogi2004 Bali Sculptures (APIO15_sculpture) C++14
21 / 100
1000 ms 8044 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(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 15 ms 4460 KB Output is correct
2 Correct 12 ms 4460 KB Output is correct
3 Correct 12 ms 4460 KB Output is correct
4 Correct 15 ms 4460 KB Output is correct
5 Correct 15 ms 4588 KB Output is correct
6 Correct 12 ms 4460 KB Output is correct
7 Correct 12 ms 4460 KB Output is correct
8 Correct 13 ms 4460 KB Output is correct
9 Correct 12 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 12 ms 4460 KB Output is correct
14 Correct 12 ms 4460 KB Output is correct
15 Incorrect 12 ms 4480 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 4460 KB Output is correct
2 Correct 12 ms 4460 KB Output is correct
3 Correct 12 ms 4460 KB Output is correct
4 Correct 12 ms 4460 KB Output is correct
5 Correct 16 ms 4460 KB Output is correct
6 Correct 12 ms 4460 KB Output is correct
7 Correct 13 ms 4460 KB Output is correct
8 Correct 12 ms 4460 KB Output is correct
9 Correct 13 ms 4460 KB Output is correct
10 Correct 13 ms 4460 KB Output is correct
11 Correct 14 ms 4460 KB Output is correct
12 Correct 12 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 12 ms 4460 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 4460 KB Output is correct
2 Correct 12 ms 4460 KB Output is correct
3 Correct 13 ms 4588 KB Output is correct
4 Correct 13 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 13 ms 4460 KB Output is correct
8 Correct 12 ms 4460 KB Output is correct
9 Correct 13 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 13 ms 4460 KB Output is correct
13 Correct 15 ms 4460 KB Output is correct
14 Correct 13 ms 4460 KB Output is correct
15 Correct 19 ms 4460 KB Output is correct
16 Correct 17 ms 4424 KB Output is correct
17 Correct 15 ms 4460 KB Output is correct
18 Correct 16 ms 4460 KB Output is correct
19 Correct 16 ms 4460 KB Output is correct
20 Correct 16 ms 4588 KB Output is correct
21 Correct 16 ms 4460 KB Output is correct
22 Correct 15 ms 4460 KB Output is correct
23 Correct 21 ms 4460 KB Output is correct
24 Correct 23 ms 4460 KB Output is correct
25 Correct 21 ms 4460 KB Output is correct
26 Correct 26 ms 4588 KB Output is correct
27 Correct 30 ms 4588 KB Output is correct
28 Correct 35 ms 4588 KB Output is correct
29 Correct 34 ms 4588 KB Output is correct
30 Correct 38 ms 4588 KB Output is correct
31 Correct 39 ms 4588 KB Output is correct
32 Correct 38 ms 4588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 4460 KB Output is correct
2 Correct 12 ms 4460 KB Output is correct
3 Correct 12 ms 4460 KB Output is correct
4 Correct 13 ms 4460 KB Output is correct
5 Correct 12 ms 4460 KB Output is correct
6 Correct 15 ms 4460 KB Output is correct
7 Correct 13 ms 4460 KB Output is correct
8 Correct 13 ms 4460 KB Output is correct
9 Correct 13 ms 4460 KB Output is correct
10 Correct 13 ms 4460 KB Output is correct
11 Correct 12 ms 4588 KB Output is correct
12 Correct 13 ms 4588 KB Output is correct
13 Correct 13 ms 4460 KB Output is correct
14 Correct 12 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 13 ms 4460 KB Output is correct
2 Correct 13 ms 4604 KB Output is correct
3 Correct 12 ms 4460 KB Output is correct
4 Correct 14 ms 4588 KB Output is correct
5 Correct 12 ms 4460 KB Output is correct
6 Correct 12 ms 4460 KB Output is correct
7 Correct 14 ms 4468 KB Output is correct
8 Correct 13 ms 4460 KB Output is correct
9 Correct 14 ms 4460 KB Output is correct
10 Correct 13 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 12 ms 4460 KB Output is correct
14 Correct 13 ms 4460 KB Output is correct
15 Correct 13 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 12 ms 4460 KB Output is correct
19 Correct 12 ms 4460 KB Output is correct
20 Correct 12 ms 4460 KB Output is correct
21 Correct 13 ms 4460 KB Output is correct
22 Correct 12 ms 4460 KB Output is correct
23 Correct 13 ms 4460 KB Output is correct
24 Correct 12 ms 4460 KB Output is correct
25 Correct 13 ms 4460 KB Output is correct
26 Correct 18 ms 4460 KB Output is correct
27 Correct 15 ms 4460 KB Output is correct
28 Correct 16 ms 4460 KB Output is correct
29 Correct 16 ms 4460 KB Output is correct
30 Correct 16 ms 4460 KB Output is correct
31 Correct 17 ms 4460 KB Output is correct
32 Correct 16 ms 4460 KB Output is correct
33 Correct 16 ms 4460 KB Output is correct
34 Correct 16 ms 4460 KB Output is correct
35 Correct 26 ms 4460 KB Output is correct
36 Correct 26 ms 4588 KB Output is correct
37 Correct 40 ms 4588 KB Output is correct
38 Correct 40 ms 4588 KB Output is correct
39 Correct 39 ms 4588 KB Output is correct
40 Correct 39 ms 4460 KB Output is correct
41 Correct 41 ms 4716 KB Output is correct
42 Correct 38 ms 4588 KB Output is correct
43 Correct 16 ms 4460 KB Output is correct
44 Correct 19 ms 4588 KB Output is correct
45 Correct 22 ms 4588 KB Output is correct
46 Correct 27 ms 4588 KB Output is correct
47 Correct 26 ms 4588 KB Output is correct
48 Correct 27 ms 4588 KB Output is correct
49 Correct 29 ms 4588 KB Output is correct
50 Correct 38 ms 4588 KB Output is correct
51 Correct 28 ms 4588 KB Output is correct
52 Execution timed out 1081 ms 8044 KB Time limit exceeded
53 Halted 0 ms 0 KB -