| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 146391 | songc | Bali Sculptures (APIO15_sculpture) | C++14 | 213 ms | 4548 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
int N, A, B;
LL S[2020];
bool chk[2020][2020];
int D[2020];
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 (A == 1){
LL ans = (1ll<<60)-1;
for (int i=59; i>=0; i--){
ans ^= (1ll<<i);
memset(D, 1, sizeof D);
D[0] = 0;
for (int j=1; j<=N; j++) for (int k=0; k<j; k++) if ((ans | (S[j]-S[k])) == ans) D[j] = min(D[j], D[k]+1);
if (D[N] > B) ans ^= (1ll<<i);
}
printf("%lld\n", ans);
}
else{
LL ans = (1ll<<60)-1;
for (int i=59; i>=0; i--){
ans ^= (1ll<<i);
memset(chk, false, sizeof chk);
chk[0][0] = true;
for (int j=1; j<=N; j++) for (int k=1; k<=j; k++){
for (int l=0; l<j; l++) if ((ans | (S[j]-S[l])) == ans) chk[j][k] = chk[j][k] || chk[l][k-1];
}
bool tf = true;
for (int j=A; j<=B; j++) if (chk[N][j]) tf = false;
if (tf) ans ^= (1ll<<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... | ||||
