Submission #239604

# Submission time Handle Problem Language Result Execution time Memory
239604 2020-06-16T17:45:42 Z michao Bali Sculptures (APIO15_sculpture) C++14
100 / 100
711 ms 1060 KB
#include <bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const int MAX=2005;
int tab[MAX];
int32_t main()
{
  BOOST;
  int n,a,b;
  cin>>n>>a>>b;
  for (int i=0;i<n;i++)cin>>tab[i];
  ll ans=0;
  for (int i=40;i>=0;i--)
  {
  	vector<bitset<MAX>>dp(n+1);
  	dp[0]=1;
  	for (int j=1;j<=n;j++)
  	{
  		ll akt=0;
  		for (int k=j-1;k>=0;k--)
  		{
  			akt+=tab[k];
  			if (!(akt&(1LL<<i)) && ((ans|(akt>>(i+1)))==ans))dp[j]|=(dp[k]<<1);
  		}
  	}
  	bool t=false;
  	for (int j=a;j<=b;j++) if (dp[n][j]){t=true;break;}
  	ans*=2;
  	if (!t)ans++;
  }
  cout<<ans;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 360 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 256 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 5 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 5 ms 400 KB Output is correct
36 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 6 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 6 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
29 Correct 7 ms 384 KB Output is correct
30 Correct 7 ms 256 KB Output is correct
31 Correct 7 ms 384 KB Output is correct
32 Correct 7 ms 384 KB Output is correct
33 Correct 8 ms 384 KB Output is correct
34 Correct 7 ms 384 KB Output is correct
35 Correct 7 ms 384 KB Output is correct
36 Correct 8 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 6 ms 384 KB Output is correct
17 Correct 7 ms 384 KB Output is correct
18 Correct 7 ms 384 KB Output is correct
19 Correct 8 ms 384 KB Output is correct
20 Correct 7 ms 384 KB Output is correct
21 Correct 7 ms 384 KB Output is correct
22 Correct 8 ms 384 KB Output is correct
23 Correct 8 ms 384 KB Output is correct
24 Correct 10 ms 384 KB Output is correct
25 Correct 10 ms 384 KB Output is correct
26 Correct 12 ms 384 KB Output is correct
27 Correct 14 ms 384 KB Output is correct
28 Correct 15 ms 384 KB Output is correct
29 Correct 16 ms 384 KB Output is correct
30 Correct 17 ms 384 KB Output is correct
31 Correct 16 ms 384 KB Output is correct
32 Correct 16 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 6 ms 384 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 5 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 5 ms 384 KB Output is correct
36 Correct 5 ms 384 KB Output is correct
37 Correct 5 ms 384 KB Output is correct
38 Correct 5 ms 384 KB Output is correct
39 Correct 6 ms 384 KB Output is correct
40 Correct 7 ms 384 KB Output is correct
41 Correct 7 ms 384 KB Output is correct
42 Correct 8 ms 384 KB Output is correct
43 Correct 8 ms 384 KB Output is correct
44 Correct 8 ms 384 KB Output is correct
45 Correct 7 ms 384 KB Output is correct
46 Correct 8 ms 384 KB Output is correct
47 Correct 7 ms 384 KB Output is correct
48 Correct 10 ms 512 KB Output is correct
49 Correct 12 ms 384 KB Output is correct
50 Correct 15 ms 384 KB Output is correct
51 Correct 17 ms 384 KB Output is correct
52 Correct 16 ms 384 KB Output is correct
53 Correct 16 ms 384 KB Output is correct
54 Correct 16 ms 384 KB Output is correct
55 Correct 17 ms 384 KB Output is correct
56 Correct 6 ms 384 KB Output is correct
57 Correct 7 ms 384 KB Output is correct
58 Correct 8 ms 512 KB Output is correct
59 Correct 8 ms 384 KB Output is correct
60 Correct 8 ms 512 KB Output is correct
61 Correct 8 ms 384 KB Output is correct
62 Correct 10 ms 384 KB Output is correct
63 Correct 9 ms 384 KB Output is correct
64 Correct 15 ms 384 KB Output is correct
65 Correct 6 ms 384 KB Output is correct
66 Correct 6 ms 384 KB Output is correct
67 Correct 7 ms 288 KB Output is correct
68 Correct 7 ms 384 KB Output is correct
69 Correct 9 ms 384 KB Output is correct
70 Correct 8 ms 384 KB Output is correct
71 Correct 8 ms 384 KB Output is correct
72 Correct 10 ms 384 KB Output is correct
73 Correct 10 ms 384 KB Output is correct
74 Correct 9 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 7 ms 384 KB Output is correct
27 Correct 7 ms 384 KB Output is correct
28 Correct 7 ms 384 KB Output is correct
29 Correct 7 ms 384 KB Output is correct
30 Correct 7 ms 384 KB Output is correct
31 Correct 8 ms 384 KB Output is correct
32 Correct 7 ms 384 KB Output is correct
33 Correct 8 ms 384 KB Output is correct
34 Correct 7 ms 384 KB Output is correct
35 Correct 10 ms 412 KB Output is correct
36 Correct 12 ms 384 KB Output is correct
37 Correct 14 ms 384 KB Output is correct
38 Correct 16 ms 384 KB Output is correct
39 Correct 15 ms 384 KB Output is correct
40 Correct 17 ms 384 KB Output is correct
41 Correct 16 ms 384 KB Output is correct
42 Correct 16 ms 384 KB Output is correct
43 Correct 6 ms 384 KB Output is correct
44 Correct 7 ms 384 KB Output is correct
45 Correct 8 ms 384 KB Output is correct
46 Correct 8 ms 384 KB Output is correct
47 Correct 7 ms 384 KB Output is correct
48 Correct 7 ms 384 KB Output is correct
49 Correct 9 ms 384 KB Output is correct
50 Correct 9 ms 384 KB Output is correct
51 Correct 9 ms 384 KB Output is correct
52 Correct 89 ms 512 KB Output is correct
53 Correct 132 ms 580 KB Output is correct
54 Correct 239 ms 756 KB Output is correct
55 Correct 214 ms 640 KB Output is correct
56 Correct 711 ms 924 KB Output is correct
57 Correct 701 ms 912 KB Output is correct
58 Correct 438 ms 896 KB Output is correct
59 Correct 363 ms 896 KB Output is correct
60 Correct 576 ms 896 KB Output is correct
61 Correct 10 ms 384 KB Output is correct
62 Correct 128 ms 732 KB Output is correct
63 Correct 224 ms 728 KB Output is correct
64 Correct 197 ms 640 KB Output is correct
65 Correct 346 ms 780 KB Output is correct
66 Correct 476 ms 1060 KB Output is correct
67 Correct 656 ms 912 KB Output is correct
68 Correct 647 ms 1012 KB Output is correct
69 Correct 567 ms 912 KB Output is correct