# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
972707 | Halym2007 | Bali Sculptures (APIO15_sculpture) | C++17 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e3 + 5;
ll n, A, B, dp[N], a[N], dp1[105][105];
bool check1 (ll x) {
for (int i = 0; i <= n; ++i) {
for (int j = 0; j <= n; ++j) {
dp1[i][j] = 1e9;
}
}
dp1[0][0] = 0;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= i; ++j) {
ll sum = 0;
for (int k = i; k > 0; k--) {
sum += a[k];
if ((sum & x) == sum) {
dp1[i][j] = min (dp1[i][j], dp1[k - 1][j - 1] + 1);
}
}
}
}
for (int i = A; i <= B; ++i) {
if (dp1[n][i] != 1e9) return 1;
return 0;
}
}
int main () {
// freopen ("input.txt", "r", stdin);
cin >> n >> A >> B;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
}
ll x = (1LL << 42) - 1;
for (int i = 41; i >= 0; i--) {
x ^= (1LL << i);
if (!check1(x)) {
x ^= (1LL << i);
}
}
cout << x << "\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... |