Submission #299502

# Submission time Handle Problem Language Result Execution time Memory
299502 2020-09-15T04:57:07 Z Muhammetali Bali Sculptures (APIO15_sculpture) C++11
9 / 100
1000 ms 512 KB
#include <bits/stdc++.h>
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
int n,a,b;
ll res=200000000000;
ll y[10001],jem[10001];
vl v;
void func(int k)
{
	if (k==n)
	{
		if (sz(v)>=a && sz(v)<=b)
		{
			ll sum=0;
			for (int i=0;i<sz(v);i++) sum|=v[i];
			res=min(res,sum);
		}
		return;
	}
	for (int i=k;i<n;i++)
	{
		v.pb(jem[i]-jem[k-1]);
		func(i+1);
		v.pop_back();
	}
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	
	cin >> n >> a >> b;
	for (int i=0;i<n;i++) cin >> y[i];
	jem[-1]=0;
	jem[0]=y[0];
	for (int i=1;i<n;i++) jem[i]=jem[i-1]+y[i];
	func(0);
	cout << res;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:55:8: warning: array subscript -1 is below array bounds of 'll [10001]' {aka 'long long int [10001]'} [-Warray-bounds]
   55 |  jem[-1]=0;
      |  ~~~~~~^
sculpture.cpp:27:13: note: while referencing 'jem'
   27 | ll y[10001],jem[10001];
      |             ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 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 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 8 ms 384 KB Output is correct
9 Correct 8 ms 512 KB Output is correct
10 Correct 8 ms 384 KB Output is correct
11 Correct 8 ms 384 KB Output is correct
12 Correct 8 ms 288 KB Output is correct
13 Correct 12 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 512 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 8 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 8 ms 384 KB Output is correct
25 Correct 8 ms 512 KB Output is correct
26 Correct 12 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 4 ms 512 KB Output is correct
31 Correct 8 ms 384 KB Output is correct
32 Correct 8 ms 384 KB Output is correct
33 Correct 11 ms 384 KB Output is correct
34 Correct 12 ms 384 KB Output is correct
35 Correct 8 ms 384 KB Output is correct
36 Correct 12 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 8 ms 384 KB Output is correct
9 Correct 8 ms 384 KB Output is correct
10 Correct 8 ms 384 KB Output is correct
11 Correct 8 ms 384 KB Output is correct
12 Correct 8 ms 384 KB Output is correct
13 Correct 12 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 9 ms 512 KB Output is correct
22 Correct 9 ms 512 KB Output is correct
23 Correct 8 ms 384 KB Output is correct
24 Correct 8 ms 512 KB Output is correct
25 Correct 8 ms 384 KB Output is correct
26 Correct 11 ms 384 KB Output is correct
27 Correct 23 ms 384 KB Output is correct
28 Correct 246 ms 504 KB Output is correct
29 Execution timed out 1057 ms 384 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 9 ms 384 KB Output is correct
9 Correct 8 ms 384 KB Output is correct
10 Correct 8 ms 384 KB Output is correct
11 Correct 9 ms 512 KB Output is correct
12 Correct 8 ms 384 KB Output is correct
13 Correct 13 ms 384 KB Output is correct
14 Correct 25 ms 416 KB Output is correct
15 Correct 250 ms 504 KB Output is correct
16 Execution timed out 1049 ms 384 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 288 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 8 ms 384 KB Output is correct
9 Correct 8 ms 384 KB Output is correct
10 Correct 8 ms 384 KB Output is correct
11 Correct 8 ms 384 KB Output is correct
12 Correct 8 ms 384 KB Output is correct
13 Correct 12 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 8 ms 384 KB Output is correct
22 Correct 8 ms 384 KB Output is correct
23 Correct 9 ms 384 KB Output is correct
24 Correct 8 ms 384 KB Output is correct
25 Correct 8 ms 384 KB Output is correct
26 Correct 11 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 4 ms 384 KB Output is correct
31 Correct 9 ms 512 KB Output is correct
32 Correct 8 ms 384 KB Output is correct
33 Correct 12 ms 384 KB Output is correct
34 Correct 12 ms 384 KB Output is correct
35 Correct 8 ms 384 KB Output is correct
36 Correct 12 ms 384 KB Output is correct
37 Correct 24 ms 384 KB Output is correct
38 Correct 237 ms 384 KB Output is correct
39 Execution timed out 1058 ms 384 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 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 384 KB Output is correct
5 Correct 1 ms 512 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 2 ms 512 KB Output is correct
8 Correct 8 ms 384 KB Output is correct
9 Correct 8 ms 384 KB Output is correct
10 Correct 8 ms 384 KB Output is correct
11 Correct 8 ms 384 KB Output is correct
12 Correct 8 ms 384 KB Output is correct
13 Correct 13 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 9 ms 384 KB Output is correct
19 Correct 8 ms 384 KB Output is correct
20 Correct 11 ms 384 KB Output is correct
21 Correct 12 ms 384 KB Output is correct
22 Correct 8 ms 512 KB Output is correct
23 Correct 12 ms 384 KB Output is correct
24 Correct 25 ms 512 KB Output is correct
25 Correct 257 ms 504 KB Output is correct
26 Execution timed out 1040 ms 384 KB Time limit exceeded
27 Halted 0 ms 0 KB -