# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
111215 | 2019-05-14T08:34:09 Z | ppnxblstr | Bali Sculptures (APIO15_sculpture) | C++14 | 3 ms | 512 KB |
#include <bits/stdc++.h> using namespace std; int arr[2048]; long long qs[2048]; int dp[2048]; int main(){ int n,a,b; scanf("%d%d%d",&n,&a,&b); for(int i = 1; i <= n; i++){ scanf("%d",arr+i); qs[i] = qs[i-1] + arr[i]; } long long ans = 0ll; for(int i = 60; i >= 0; i--){ memset(dp, 0x1F, sizeof(dp)); dp[0] = 0; for(int j = 1; j <= n; j++){ for(int l = 0; l < j; l++){ if((((qs[j] - qs[l]) >> (long long)i) << (long long)i) == ans){ dp[j] = min(dp[j], dp[l]+1); } } } if(dp[n] > b){ ans += 1ll << (long long)i; } } printf("%lld\n",ans); return 0; } /* 6 1 3 8 1 2 1 5 4 */
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 | 372 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 | 3 ms | 512 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 | 2 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |