답안 #299501

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
299501 2020-09-15T04:52:47 Z Muhammetali Bali Sculptures (APIO15_sculpture) C++11
0 / 100
1000 ms 520 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=INT_MAX;
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=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: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 Correct 1 ms 384 KB Output is correct
2 Correct 0 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 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 2 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 512 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 512 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 288 KB Output is correct
20 Correct 2 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 11 ms 384 KB Output is correct
27 Incorrect 1 ms 384 KB Output isn't correct
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 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 2 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 512 KB Output is correct
11 Correct 8 ms 384 KB Output is correct
12 Correct 8 ms 384 KB Output is correct
13 Correct 11 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 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 9 ms 384 KB Output is correct
26 Correct 11 ms 384 KB Output is correct
27 Correct 25 ms 384 KB Output is correct
28 Correct 240 ms 520 KB Output is correct
29 Execution timed out 1046 ms 384 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 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 512 KB Output is correct
13 Correct 12 ms 384 KB Output is correct
14 Correct 23 ms 512 KB Output is correct
15 Correct 242 ms 384 KB Output is correct
16 Execution timed out 1067 ms 384 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 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 14 ms 512 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 2 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 384 KB Output is correct
26 Correct 11 ms 384 KB Output is correct
27 Incorrect 1 ms 384 KB Output isn't correct
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 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 10 ms 384 KB Output is correct
13 Correct 12 ms 384 KB Output is correct
14 Incorrect 1 ms 384 KB Output isn't correct
15 Halted 0 ms 0 KB -