답안 #112535

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
112535 2019-05-20T12:45:20 Z TuGSGeReL Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1000 ms 504 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>;

int  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++ )
	{
		int 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;
	
}
# 결과 실행 시간 메모리 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 12 ms 384 KB Output is correct
8 Correct 92 ms 384 KB Output is correct
9 Correct 80 ms 384 KB Output is correct
10 Correct 81 ms 384 KB Output is correct
11 Correct 81 ms 384 KB Output is correct
12 Correct 81 ms 376 KB Output is correct
13 Correct 81 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Incorrect 1 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 80 ms 384 KB Output is correct
9 Correct 83 ms 376 KB Output is correct
10 Correct 80 ms 384 KB Output is correct
11 Correct 80 ms 376 KB Output is correct
12 Correct 80 ms 384 KB Output is correct
13 Correct 79 ms 376 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 -
# 결과 실행 시간 메모리 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 80 ms 384 KB Output is correct
9 Correct 80 ms 376 KB Output is correct
10 Correct 81 ms 384 KB Output is correct
11 Correct 80 ms 384 KB Output is correct
12 Correct 79 ms 384 KB Output is correct
13 Correct 81 ms 384 KB Output is correct
14 Correct 173 ms 504 KB Output is correct
15 Execution timed out 1034 ms 384 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 12 ms 384 KB Output is correct
8 Correct 82 ms 504 KB Output is correct
9 Correct 83 ms 420 KB Output is correct
10 Correct 80 ms 384 KB Output is correct
11 Correct 81 ms 384 KB Output is correct
12 Correct 80 ms 476 KB Output is correct
13 Correct 79 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Incorrect 2 ms 384 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 1 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 13 ms 384 KB Output is correct
8 Correct 80 ms 384 KB Output is correct
9 Correct 80 ms 504 KB Output is correct
10 Correct 80 ms 384 KB Output is correct
11 Correct 80 ms 376 KB Output is correct
12 Correct 80 ms 384 KB Output is correct
13 Correct 79 ms 384 KB Output is correct
14 Incorrect 2 ms 384 KB Output isn't correct
15 Halted 0 ms 0 KB -