Submission #527424

# Submission time Handle Problem Language Result Execution time Memory
527424 2022-02-17T11:29:09 Z Koosha_mv Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 332 KB
#include <bits/stdc++.h>
using namespace std;
#define dbgv(v) cout<<#v<<" = "; f(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
#define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl
#define erorp(x) cout<<#x<<"={"<<(x.F)<<" , "<<x.S<<"}"<<endl
#define eror(x) cout<<#x<<'='<<(x)<<endl
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define f(i,a,b) for(int i=a;i<b;i++)
#define nb(x) __builtin_popcount(x)
#define all(v) v.begin(),v.end()
#define bit(n,k) (((n)>>(k))&1)
#define Add(x,y) x=(x+y)%mod
#define maxm(a,b) a=max(a,b)
#define minm(a,b) a=min(a,b)
#define lst(x) x[x.size()-1]
#define sz(x) int(x.size())
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first
#define int ll

const int N=105,lg=50;

int n,t,ans,L,R,a[N],dp[N][N];

bool check(int mask){
	f(i,0,N) f(j,0,N) dp[i][j]=0;
	dp[0][0]=1;	
	f(i,1,n+1){
		f(j,1,i+1){
			f(k,0,i){
				if(((a[i]-a[k])|mask)==mask){
					dp[i][j]|=dp[k][j-1];
				}
			}
		}
	}
	f(i,L,R+1) if(dp[n][i]) return 1;
	return 0;
}

main(){
	ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
	cin>>n>>L>>R;
	f(i,1,n+1){
		cin>>a[i];
		a[i]+=a[i-1];
	}
	ans=(1<<lg)-1;
	f_(i,lg-1,0){
		if(check(ans^(1<<i))){
			ans^=(1<<i);
		}
	}
	cout<<ans;
}

Compilation message

sculpture.cpp:44:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   44 | main(){
      | ^~~~
sculpture.cpp: In function 'int main()':
sculpture.cpp:51:8: warning: left shift count >= width of type [-Wshift-count-overflow]
   51 |  ans=(1<<lg)-1;
      |       ~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -