# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
27458 | 2017-07-13T04:45:52 Z | TAMREF | Bali Sculptures (APIO15_sculpture) | C++11 | 0 ms | 33320 KB |
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ll; const int mx=2005; int N,A,B; ll S[mx]; void input(){ scanf("%d%d%d",&N,&A,&B); for(int i=1;i<=N;i++){ scanf("%llu",&S[i]); S[i]+=S[i-1]; } } void solve_n3(){ ll dp3[mx][mx]; for(int i=1;i<=N;i++) for(int j=0;j<=N;j++) dp3[i][j]=ULLONG_MAX; for(int j=0;j<=N;j++) dp3[0][j]=0; for(int i=1;i<=N;i++){ for(int j=1;j<=i;j++) for(int k=j-1;k<i;k++){ dp3[i][j]=min(dp3[i][j],dp3[k][j-1]|(S[i]-S[k])); //printf("dp[%d][%d]=%llu\n",i,j,dp3[i][j]); } } //for(int x=1;x<=N;x++,puts("")) for(int i=1;i<=N;i++) printf("%llu ",dp3[x][i]); printf("%llu\n",*min_element(dp3[N]+A,dp3[N]+B+1)); } int main(){ input(); solve_n3(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 33316 KB | Output is correct |
2 | Incorrect | 0 ms | 33320 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 33320 KB | Output is correct |
2 | Incorrect | 0 ms | 33316 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 33316 KB | Output is correct |
2 | Incorrect | 0 ms | 33320 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 33320 KB | Output is correct |
2 | Incorrect | 0 ms | 33320 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 33316 KB | Output is correct |
2 | Incorrect | 0 ms | 33320 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |