# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101239 | 2019-03-18T03:32:13 Z | arman_ferdous | Bali Sculptures (APIO15_sculpture) | C++17 | 155 ms | 16248 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 2010; int n, A, B; ll a[N], sum[N], mask, diff; int dp4[N][N], dp5[N]; int DP4(int pos, int parts) { if(pos > n) { if(A <= parts && parts <= B) return 1; return 0; } if(parts > B) 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 ^ s) < diff) 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]); sum[i] = sum[i-1] + a[i]; } if(n <= 110) { for(int i = 42; i >= 0; i--) { memset(dp4, -1, sizeof dp4); diff = (1ll<<i); if(!DP4(1,0)) mask |= (1ll<<i); } printf("%lld\n", mask); return 0; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 154 ms | 16248 KB | Output is correct |
2 | Incorrect | 132 ms | 16128 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 153 ms | 16248 KB | Output is correct |
2 | Incorrect | 149 ms | 16188 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 134 ms | 16180 KB | Output is correct |
2 | Incorrect | 99 ms | 16220 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 94 ms | 16248 KB | Output is correct |
2 | Incorrect | 59 ms | 16128 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 155 ms | 16128 KB | Output is correct |
2 | Incorrect | 152 ms | 16128 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |