답안 #299497

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
299497 2020-09-15T04:46:43 Z Muhammetali Bali Sculptures (APIO15_sculpture) C++11
0 / 100
1 ms 384 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,res;
ll y[10001],jem[10001];
vi v;
void func(int k)
{
	if (k==n)
	{
		if (sz(v)>=a && sz(v)<=b)
		{
			int sum=0;
			for (int i=0;i<sz(v);i++) sum|=v[i];
			res=max(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:54:8: warning: array subscript -1 is below array bounds of 'll [10001]' {aka 'long long int [10001]'} [-Warray-bounds]
   54 |  jem[-1]=0;
      |  ~~~~~~^
sculpture.cpp:26:13: note: while referencing 'jem'
   26 | ll y[10001],jem[10001];
      |             ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -