| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1326131 | hoangtien69 | Bali Sculptures (APIO15_sculpture) | C++20 | 51 ms | 484 KiB |
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e3 + 5;
#define int long long
#define LLONG_MIN -1e18
#define LLONG_MAX 1e18
int n, l, r;
int maxx[MAXN];
int minn[MAXN];
int pre[MAXN];
int a[MAXN];
int ans = 0;
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> l >> r;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
pre[i] = pre[i - 1] + a[i];
}
for (int i = 40; i >= 0; i--)
{
int lim = ans | ((1LL << i) - 1);
maxx[0] = 0;
minn[0] = 0;
for (int j = 1; j <= n; j++)
{
maxx[j] = LLONG_MIN;
minn[j] = LLONG_MAX;
for (int k = 1; k <= j; k++)
{
int val = pre[j] - pre[k - 1];
if ((val & lim) == val)
{
if (maxx[k - 1] != LLONG_MIN)
maxx[j] = max(maxx[j], maxx[k - 1] + 1);
if (minn[k - 1] != LLONG_MAX)
minn[j] = min(minn[j], minn[k - 1] + 1);
}
}
}
if (maxx[n] < l || minn[n] > r)
{
ans |= (1LL << i);
}
}
cout << 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... | ||||
