# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
551317 | radaiosm7 | Bali Sculptures (APIO15_sculpture) | C++98 | 1 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n, a, b, i, j, k;
long long pref[2005];
long long ar[2005];
long long dp[2005][2005];
long long ans;
int main() {
scanf("%d%d%d", &n, &a, &b);
for (i=1; i <= n; ++i) scanf("%lld", &ar[i]);
pref[0] = 0LL;
for (i=1; i <= n; ++i) pref[i] = pref[i-1]+ar[i];
for (i=0; i <= b; ++i) dp[0][i] = INT_MAX;
for (i=2; i <= n; ++i) {
dp[i][1] = pref[i];
for (j=2; j <= b; ++j) {
dp[i][j] = INT_MAX;
for (k=i-1; k > j; --k) dp[i][j] = min(dp[i][j], dp[k][j-1]|(pref[i]-pref[k]));
}
}
ans = INT_MAX;
for (i=a; i <= b; ++i) ans = min(ans, dp[n][i]);
printf("%lld\n", ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |