| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 25009 | kdh9949 | Bali Sculptures (APIO15_sculpture) | C++14 | 0 ms | 3620 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
int n, a, b;
ll s[2010], dp[101][2010], ans = inf;
int main(){
scanf("%d%d%d", &n, &a, &b);
for(int i = 1; i <= n; i++){ scanf("%lld", s + i); s[i] += s[i - 1]; }
if(n <= 100){
fill(dp[0] + 1, dp[0] + n + 1, inf);
for(int i = 1; i <= b; i++){
for(int j = i; j <= n; j++){
dp[i][j] = inf;
for(int k = i - 1; k < j; k++){
dp[i][j] = min(dp[i][j], dp[i - 1][k] | (s[j] - s[k]));
}
}
}
for(int i = a; i <= b; i++) ans = min(ans, dp[i][n]);
printf("%lld\n", ans);
}
else{
for(int i = 1; i <= n; i++){
dp[0][i] = inf;
for(int j = 0; j < i; j++){
dp[0][i] = min(dp[0][i], dp[0][j] | (s[i] - s[j]));
}
}
printf("%lld\n", dp[0][n]);
}
}
컴파일 시 표준 에러 (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... | ||||
