# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
146451 | arnold518 | Bali Sculptures (APIO15_sculpture) | C++14 | 361 ms | 32120 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 2000;
int N, A, B;
ll Y[MAXN+10], ans=0, dp1[MAXN+10], dp2[MAXN+10][MAXN+10];
int main()
{
int i, j, k, p;
scanf("%d%d%d", &N, &A, &B);
for(i=1; i<=N; i++) scanf("%lld", &Y[i]), Y[i]+=Y[i-1];
ans=(1ll<<46)-1;
if(A==1)
{
for(i=45; i>=0; i--)
{
ll now=1ll<<i;
ans^=now;
for(j=1; j<=N; j++) dp1[j]=987654321; dp1[0]=0;
for(j=1; j<=N; j++) for(k=0; k<j; k++) if((ans|(Y[j]-Y[k]))==ans) dp1[j]=min(dp1[j], dp1[k]+1);
if(dp1[N]>B) ans|=now;
}
}
else
{
for(i=45; i>=0; i--)
{
ll now=1ll<<i;
ans^=now;
memset(dp2, 0, sizeof(dp2)); dp2[0][0]=1;
for(j=1; j<=N; j++) for(k=1; k<=N; k++) for(p=0; p<j; p++) if((ans|(Y[j]-Y[p]))==ans) dp2[j][k]|=dp2[p][k-1];
bool flag=false;
for(j=A; j<=B; j++) flag|=dp2[N][j];
if(!flag) ans|=now;
}
}
printf("%lld", ans);
}
컴파일 시 표준 에러 (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... |