| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 43777 | Extazy | Bali Sculptures (APIO15_sculpture) | C++14 | 6 ms | 2120 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 2007;
int n,a,b;
long long ans;
bool used[N][N];
long long state[N][N];
long long arr[N];
long long get_sum(int l, int r) {
return arr[r]-arr[l-1];
}
long long recurse(int pos, int groups) {
if(groups<0) return 1000000000000000000;
if(pos>n) {
if(groups==0) return 0;
return 1;
}
if(used[pos][groups]) return state[pos][groups];
int i;
long long ans=1000000000000000000;
for(i=pos;i<=n;i++) {
ans=min(ans,recurse(i+1,groups-1)|get_sum(pos,i));
}
used[pos][groups]=true;
return state[pos][groups]=ans;
}
int main() {
int i;
scanf("%d %d %d", &n, &a, &b);
for(i=1;i<=n;i++) {
scanf("%lld", &arr[i]);
arr[i]+=arr[i-1];
}
ans=recurse(1,a);
while(++a<=b) ans=min(ans,recurse(1,a));
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... | ||||
