Submission #101257

# Submission time Handle Problem Language Result Execution time Memory
101257 2019-03-18T05:00:00 Z arman_ferdous Bali Sculptures (APIO15_sculpture) C++17
0 / 100
3 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
const int N = 2010;

int n, A, B;
ll a[N], mask, bitpos;

int dp4[105][105], dp5[N];
int DP4(int pos, int parts) {
	if(pos > n) {
		if(A <= parts && parts <= B) return 1;
		return 0;
	}
	if(dp4[pos][parts] != -1) return dp4[pos][parts];

	int &ret = dp4[pos][parts]; ret = 0;
	ll s = 0;
	for(int i = pos; i <= n; i++) {
		s += a[i];
		if((mask >> bitpos) == (s >> bitpos)) ret |= DP4(i+1, parts+1);
	}
	return ret;
}

int main() {
	scanf("%d %d %d", &n, &A, &B);
	if(n <= 100) {
		for(bitpos = 45; bitpos >= 0; bitpos--) {
			memset(dp4, -1, sizeof dp4);
			if(!DP4(1,0)) mask |= (1ll<<bitpos);
		}
		printf("%lld\n", mask);
		return 0;
	}
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:28: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);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -