Submission #49550

# Submission time Handle Problem Language Result Execution time Memory
49550 2018-05-31T07:13:49 Z hamzqq9 Bali Sculptures (APIO15_sculpture) C++14
21 / 100
3 ms 1324 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 29
#define magic 100
#define KOK 250
#define EPS 0.0025
#define pw(x) (1<<(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]);

	}

	int full=pw(30)-1;

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

		full-=pw(i);

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

	}

	printf("%d",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 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 3 ms 768 KB Output is correct
5 Correct 2 ms 768 KB Output is correct
6 Correct 2 ms 768 KB Output is correct
7 Correct 2 ms 768 KB Output is correct
8 Correct 3 ms 780 KB Output is correct
9 Correct 3 ms 780 KB Output is correct
10 Correct 2 ms 780 KB Output is correct
11 Correct 2 ms 780 KB Output is correct
12 Correct 2 ms 844 KB Output is correct
13 Correct 2 ms 844 KB Output is correct
14 Correct 2 ms 844 KB Output is correct
15 Incorrect 2 ms 844 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 844 KB Output is correct
2 Correct 2 ms 844 KB Output is correct
3 Correct 2 ms 844 KB Output is correct
4 Correct 2 ms 844 KB Output is correct
5 Correct 2 ms 844 KB Output is correct
6 Correct 2 ms 844 KB Output is correct
7 Correct 2 ms 844 KB Output is correct
8 Correct 2 ms 844 KB Output is correct
9 Correct 2 ms 844 KB Output is correct
10 Correct 2 ms 844 KB Output is correct
11 Correct 2 ms 844 KB Output is correct
12 Correct 2 ms 844 KB Output is correct
13 Correct 2 ms 844 KB Output is correct
14 Correct 2 ms 848 KB Output is correct
15 Incorrect 2 ms 848 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 864 KB Output is correct
2 Correct 2 ms 864 KB Output is correct
3 Correct 2 ms 864 KB Output is correct
4 Correct 3 ms 868 KB Output is correct
5 Correct 2 ms 992 KB Output is correct
6 Correct 2 ms 996 KB Output is correct
7 Correct 3 ms 1000 KB Output is correct
8 Correct 2 ms 1008 KB Output is correct
9 Correct 2 ms 1008 KB Output is correct
10 Correct 2 ms 1012 KB Output is correct
11 Correct 2 ms 1016 KB Output is correct
12 Correct 2 ms 1016 KB Output is correct
13 Correct 2 ms 1024 KB Output is correct
14 Correct 2 ms 1028 KB Output is correct
15 Correct 3 ms 1028 KB Output is correct
16 Correct 3 ms 1028 KB Output is correct
17 Correct 2 ms 1028 KB Output is correct
18 Correct 3 ms 1044 KB Output is correct
19 Correct 2 ms 1048 KB Output is correct
20 Correct 2 ms 1048 KB Output is correct
21 Correct 2 ms 1056 KB Output is correct
22 Correct 2 ms 1060 KB Output is correct
23 Correct 2 ms 1060 KB Output is correct
24 Correct 2 ms 1068 KB Output is correct
25 Correct 2 ms 1072 KB Output is correct
26 Correct 2 ms 1076 KB Output is correct
27 Correct 3 ms 1084 KB Output is correct
28 Correct 3 ms 1088 KB Output is correct
29 Correct 3 ms 1088 KB Output is correct
30 Correct 3 ms 1088 KB Output is correct
31 Correct 3 ms 1100 KB Output is correct
32 Correct 3 ms 1228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1228 KB Output is correct
2 Correct 2 ms 1228 KB Output is correct
3 Correct 2 ms 1228 KB Output is correct
4 Correct 2 ms 1228 KB Output is correct
5 Correct 2 ms 1228 KB Output is correct
6 Correct 2 ms 1228 KB Output is correct
7 Correct 2 ms 1236 KB Output is correct
8 Correct 2 ms 1240 KB Output is correct
9 Correct 2 ms 1240 KB Output is correct
10 Correct 3 ms 1240 KB Output is correct
11 Correct 2 ms 1240 KB Output is correct
12 Correct 2 ms 1240 KB Output is correct
13 Correct 2 ms 1240 KB Output is correct
14 Correct 2 ms 1240 KB Output is correct
15 Incorrect 2 ms 1240 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1240 KB Output is correct
2 Correct 2 ms 1240 KB Output is correct
3 Correct 2 ms 1240 KB Output is correct
4 Correct 2 ms 1240 KB Output is correct
5 Correct 2 ms 1240 KB Output is correct
6 Correct 2 ms 1240 KB Output is correct
7 Correct 2 ms 1240 KB Output is correct
8 Correct 2 ms 1240 KB Output is correct
9 Correct 2 ms 1324 KB Output is correct
10 Correct 3 ms 1324 KB Output is correct
11 Correct 2 ms 1324 KB Output is correct
12 Correct 2 ms 1324 KB Output is correct
13 Correct 3 ms 1324 KB Output is correct
14 Correct 3 ms 1324 KB Output is correct
15 Incorrect 2 ms 1324 KB Output isn't correct
16 Halted 0 ms 0 KB -