Submission #115564

# Submission time Handle Problem Language Result Execution time Memory
115564 2019-06-08T08:10:24 Z 임유진(#2867) Bali Sculptures (APIO15_sculpture) C++14
0 / 100
2 ms 256 KB
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>

using namespace std;

#define MAXN 105
#define LOGY 7 

long long Y[MAXN];
bool dp[MAXN][MAXN];

int main(){
	int N, A, B;
	long long ans=0, x=0;
	
	//freopen("input.txt", "r", stdin);
	
	scanf("%d%d%d", &N, &A, &B);
	for(int i=1; i<=N; i++) scanf("%lld", Y+i);

	if(A==1) return 0;

	for(int i=LOGY-1; i>=0; i--){
		dp[0][0]=true;
		for(int j=1; j<=B; j++) dp[0][j]=false;
		for(int j=1; j<=N; j++){
			long long s=0;
			for(int k=0; k<=B; k++) dp[j][k]=false;
			for(int k=j; k>=1; k--){
				s+=Y[k];
				if(((x+(1ll<<i))&s)==0){
					for(int l=0; l<B; l++) if(dp[k-1][l]) dp[j][l+1]=true;
				}
			}
		}
		bool b=false;
		for(int j=A; j<=B; j++) b|=dp[N][j];
		if(b) x+=(1ll<<i);
		else ans+=(1ll<<i);
	}
	printf("%lld", ans);
	return 0;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:19: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:20:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=N; i++) scanf("%lld", Y+i);
                          ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -