제출 #612060

#제출 시각아이디문제언어결과실행 시간메모리
612060DeMen100nsBali Sculptures (APIO15_sculpture)C++17
0 / 100
1 ms340 KiB
/* Author : DeMen100ns (a.k.a Vo Khac Trieu) School : VNU-HCM High school for the Gifted fuck you adhoc */ #include <bits/stdc++.h> #define int long long using namespace std; const int N = 100 + 5; const long long INF = numeric_limits<long long>::max() / 2; const int MAXA = 1e9; const int B = sqrt(N) + 5; int dp[N][N], sum[N][N], A[N]; void solve() { int n, a, b; cin >> n >> a >> b; for(int i = 1; i <= n; ++i){ for(int j = 1; j <= n; ++j){ dp[i][j] = INF; } } for(int i = 1; i <= n; ++i) cin >> A[i]; for(int i = 1; i <= n; ++i){ for(int j = i; j <= n; ++j){ sum[i][j] = sum[i][j - 1] + A[j]; } dp[1][i] = sum[1][i]; } int ans = INF; if (a == 1) ans = dp[1][n]; for(int tme = 2; tme <= n; ++tme){ for(int i = tme; i <= n; ++i){ for(int j = tme; j <= i; ++j){ dp[tme][i] = min(dp[tme][i], dp[tme - 1][j - 1] | sum[j][i]); } } if (tme >= a) ans = min(ans, dp[tme][n]); } cout << ans; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen("codeforces.inp","r",stdin); // freopen("codeforces.out","w",stdout); int t = 1; //cin >> t; while (t--) { solve(); } }
#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...