Submission #15868

#TimeUsernameProblemLanguageResultExecution timeMemory
15868myungwooBali Sculptures (APIO15_sculpture)C++14
0 / 100
0 ms33072 KiB
#include <bits/stdc++.h> using namespace std; #define MAXN 2003 typedef long long lld; int N, A, B; int X[MAXN]; lld D[MAXN][MAXN]; int main() { scanf("%d%d%d", &N, &A, &B); for (int i=1;i<=N;i++) scanf("%d", X+i); for (int i=1;i<=N;i++) D[1][i] = D[1][i-1] + X[i]; for (int i=2;i<=B;i++){ for (int j=i;j<=N;j++){ D[i][j] = 1e18; for (int k=j-1;k>=i-1;k--){ D[i][j] = min(D[i][j], D[i-1][k] | (D[1][j] - D[1][k])); } } } lld ans = 1e18; for (int i=A;i<=B;i++) ans = min(ans, D[i][N]); printf("%lld\n", ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...