Submission #49551

# Submission time Handle Problem Language Result Execution time Memory
49551 2018-05-31T07:16:13 Z hamzqq9 Bali Sculptures (APIO15_sculpture) C++14
21 / 100
4 ms 640 KB
#include<bits/stdc++.h>
#define lf double
#define ll long long
#define cc pair<char,char>
#define ull unsigned ll
#define ii pair<int,int>
#define li pair<ll,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define iiii2 pair<int,iii>
#define lii pair<ll,ii>
#define lolo pair<ll,ll>
#define heap priority_queue
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define all(x) x.begin(),x.end()
#define len(x) strlen(x)
#define sz(x) (int) x.size()
#define orta ((bas+son)/2)
#define min3(x,y,z) min(min(x,y),z)
#define max3(x,y,z) max(max(x,y),z)
#define umin(x,y) x=min(x,y)
#define umax(x,y) x=max(x,y)
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define MOD 1000000007
#define inf 1000000005
#define M 10000002
#define N 2005
#define LOG 59
#define magic 100
#define KOK 250
#define EPS 0.0025
#define pw(x) ((1ll)<<(x))
#define PI 3.1415926535
using namespace std;

int n,a,b;
int ar[N],dp[N];

bool ok(int val) {

	dp[0]=0;

	for(int i=1;i<=n;i++) {

		dp[i]=inf;

		ll sum=0;

		for(int j=i-1;j>=0;j--) {

			sum+=ar[j+1];

			if((sum|val)==val) umin(dp[i],dp[j]+1);

		}

	}

	return (dp[n]<=b);

}
int main() {
 
 	#if 0
	freopen("input.txt","r",stdin);
 	#endif

	scanf("%d %d %d",&n,&a,&b);

	for(int i=1;i<=n;i++) {

		scanf("%d",&ar[i]);

	}

	ll full=pw(60)-1;

	for(int i=LOG;i>=0;i--) {

		full-=pw(i);

		if(!ok(full)) full+=pw(i);

	}

	printf("%lld",full);

}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:75:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d",&n,&a,&b);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:79:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&ar[i]);
   ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 416 KB Output is correct
4 Correct 2 ms 500 KB Output is correct
5 Correct 2 ms 532 KB Output is correct
6 Correct 2 ms 532 KB Output is correct
7 Correct 2 ms 532 KB Output is correct
8 Correct 3 ms 532 KB Output is correct
9 Correct 2 ms 532 KB Output is correct
10 Correct 3 ms 532 KB Output is correct
11 Correct 3 ms 536 KB Output is correct
12 Correct 2 ms 548 KB Output is correct
13 Correct 2 ms 548 KB Output is correct
14 Correct 2 ms 548 KB Output is correct
15 Incorrect 2 ms 548 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 592 KB Output is correct
2 Correct 2 ms 592 KB Output is correct
3 Correct 2 ms 592 KB Output is correct
4 Correct 2 ms 592 KB Output is correct
5 Correct 4 ms 636 KB Output is correct
6 Correct 2 ms 636 KB Output is correct
7 Correct 3 ms 636 KB Output is correct
8 Correct 3 ms 636 KB Output is correct
9 Correct 2 ms 636 KB Output is correct
10 Correct 2 ms 636 KB Output is correct
11 Correct 2 ms 636 KB Output is correct
12 Correct 2 ms 636 KB Output is correct
13 Correct 2 ms 636 KB Output is correct
14 Correct 2 ms 636 KB Output is correct
15 Incorrect 2 ms 636 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 636 KB Output is correct
2 Correct 2 ms 636 KB Output is correct
3 Correct 2 ms 636 KB Output is correct
4 Correct 2 ms 636 KB Output is correct
5 Correct 2 ms 636 KB Output is correct
6 Correct 2 ms 636 KB Output is correct
7 Correct 2 ms 636 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 2 ms 640 KB Output is correct
12 Correct 2 ms 640 KB Output is correct
13 Correct 2 ms 640 KB Output is correct
14 Correct 2 ms 640 KB Output is correct
15 Correct 2 ms 640 KB Output is correct
16 Correct 2 ms 640 KB Output is correct
17 Correct 2 ms 640 KB Output is correct
18 Correct 2 ms 640 KB Output is correct
19 Correct 3 ms 640 KB Output is correct
20 Correct 3 ms 640 KB Output is correct
21 Correct 3 ms 640 KB Output is correct
22 Correct 3 ms 640 KB Output is correct
23 Correct 2 ms 640 KB Output is correct
24 Correct 2 ms 640 KB Output is correct
25 Correct 3 ms 640 KB Output is correct
26 Correct 3 ms 640 KB Output is correct
27 Correct 3 ms 640 KB Output is correct
28 Correct 4 ms 640 KB Output is correct
29 Correct 4 ms 640 KB Output is correct
30 Correct 3 ms 640 KB Output is correct
31 Correct 4 ms 640 KB Output is correct
32 Correct 3 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 2 ms 640 KB Output is correct
6 Correct 2 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 2 ms 640 KB Output is correct
12 Correct 2 ms 640 KB Output is correct
13 Correct 2 ms 640 KB Output is correct
14 Correct 3 ms 640 KB Output is correct
15 Incorrect 2 ms 640 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 2 ms 640 KB Output is correct
6 Correct 2 ms 640 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 2 ms 640 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 2 ms 640 KB Output is correct
12 Correct 2 ms 640 KB Output is correct
13 Correct 2 ms 640 KB Output is correct
14 Correct 2 ms 640 KB Output is correct
15 Correct 3 ms 640 KB Output is correct
16 Correct 3 ms 640 KB Output is correct
17 Incorrect 3 ms 640 KB Output isn't correct
18 Halted 0 ms 0 KB -