# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
455093 | 2021-08-05T12:24:17 Z | qwerasdfzxcl | Bali Sculptures (APIO15_sculpture) | C++14 | 1 ms | 332 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; int a[2020]; ll dp[2020][2020]; int main(){ int n, l, r; scanf("%d %d %d", &n, &l, &r); for (int i=1;i<=n;i++) scanf("%d", a+i); for (int i=1;i<=n;i++){ dp[i][1] = dp[i-1][1]+a[i]; for (int j=2;j<=i;j++){ dp[i][j] = 1e18; ll cur = 0; for (int k=i;k>j-1;k--){ cur += a[k]; dp[i][j] = min(dp[i][j], dp[i-1][k-1]|cur); } } /*for (int j=1;j<=i;j++) printf("%lld ", dp[i][j]); printf("\n");*/ } ll ans = 1e18; for (int i=l;i<=r;i++) ans = min(ans, dp[n][i]); printf("%lld\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Incorrect | 1 ms | 332 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 332 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Incorrect | 1 ms | 332 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Incorrect | 1 ms | 332 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Incorrect | 1 ms | 332 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |