Submission #112537

# Submission time Handle Problem Language Result Execution time Memory
112537 2019-05-20T12:47:06 Z TuGSGeReL Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1000 ms 512 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define mp make_pair
#define pub push_back
#define pob pop_back()
#define ss second
#define ff first
#define mt make_tuple
#define pof pop_front()
#define fbo find_by_order
#define ook order_of_key
#define lb lower_bound
#define ub upper_bound

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
using pll = pair <ll, ll>;
using pii = pair <int, int>;

ll  n, a, b, x[1001], ans = 1e9;

int main ()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin >> n >> a >> b;
	
	for (int i = 1; i <= n; i++)
		cin >> x[i];
		
	for (int i = 0; i < ( 1 << n ); i++ )
	{
		ll s = 0, k = 0, res = 0, seg = 1;
		for (int j = 0; j < n; j++)
		{
			if ( (i & (1 << j)) )
			{
				if ( k == 0 )
				{
					k = 1;
					res |= s;
					s = x[j + 1];
					seg++;
				} else {
					s += x[j + 1];
				}
			} else {
				if ( k == 0 )
					s += x[j + 1];
				else {
					res |= s;
					s = x[j + 1];
					k = 0;
					seg++;
				}
			}
		}
		res |= s;
		if (seg <= b && seg >= a )
			ans = min(ans, res);
	}
	
	cout << ans;
	
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 10 ms 384 KB Output is correct
8 Correct 77 ms 504 KB Output is correct
9 Correct 76 ms 504 KB Output is correct
10 Correct 75 ms 384 KB Output is correct
11 Correct 77 ms 476 KB Output is correct
12 Correct 79 ms 384 KB Output is correct
13 Correct 78 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Incorrect 2 ms 512 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 10 ms 384 KB Output is correct
8 Correct 77 ms 384 KB Output is correct
9 Correct 80 ms 416 KB Output is correct
10 Correct 78 ms 376 KB Output is correct
11 Correct 79 ms 384 KB Output is correct
12 Correct 77 ms 384 KB Output is correct
13 Correct 79 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Incorrect 2 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 11 ms 384 KB Output is correct
8 Correct 147 ms 384 KB Output is correct
9 Correct 75 ms 384 KB Output is correct
10 Correct 93 ms 384 KB Output is correct
11 Correct 78 ms 384 KB Output is correct
12 Correct 75 ms 384 KB Output is correct
13 Correct 75 ms 384 KB Output is correct
14 Correct 153 ms 384 KB Output is correct
15 Execution timed out 1078 ms 384 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 10 ms 384 KB Output is correct
8 Correct 75 ms 376 KB Output is correct
9 Correct 75 ms 384 KB Output is correct
10 Correct 77 ms 384 KB Output is correct
11 Correct 78 ms 384 KB Output is correct
12 Correct 75 ms 376 KB Output is correct
13 Correct 75 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Incorrect 2 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 10 ms 384 KB Output is correct
8 Correct 75 ms 504 KB Output is correct
9 Correct 75 ms 384 KB Output is correct
10 Correct 76 ms 504 KB Output is correct
11 Correct 75 ms 420 KB Output is correct
12 Correct 75 ms 384 KB Output is correct
13 Correct 75 ms 384 KB Output is correct
14 Incorrect 2 ms 384 KB Output isn't correct
15 Halted 0 ms 0 KB -