# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101258 | 2019-03-18T05:00:57 Z | arman_ferdous | Bali Sculptures (APIO15_sculpture) | C++17 | 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); for(int i = 1; i <= n; i++) scanf("%lld", &a[i]); 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Incorrect | 2 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Incorrect | 3 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Incorrect | 3 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Incorrect | 3 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Incorrect | 2 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |