# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
609553 | Plurm | Bali Sculptures (APIO15_sculpture) | C++11 | 466 ms | 4428 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int y[2048];
int dp[2048];
bool check[2048][2048];
int main() {
int n, a, b;
scanf("%d%d%d", &n, &a, &b);
for (int i = 1; i <= n; i++) {
scanf("%d", y + i);
}
long long oldmask = 0ll;
for (long long bit = 60; bit >= 0; bit--) {
long long mask = oldmask | ((1ll << bit) - 1ll);
for (int i = 1; i <= n; i++) {
long long sum = 0ll;
for (int j = i; j <= n; j++) {
sum += y[j];
check[i][j] = (sum | mask) == mask;
}
}
for (int i = 1; i <= n; i++) {
if (check[1][i])
dp[i] = 1;
else
dp[i] = 1e9;
for (int j = 1; j < i; j++) {
if (check[j + 1][i]) {
dp[i] = min(dp[j] + 1, dp[i]);
}
}
}
if (dp[n] > b) {
oldmask |= 1ll << bit;
}
}
printf("%lld\n", oldmask);
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... |