# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
78030 | xiaowuc1 | Bali Sculptures (APIO15_sculpture) | C++14 | 572 ms | 1160 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
*/
using namespace std;
const double PI = 2 * acos(0);
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<int, ll> pill;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef vector<vector<ll>> matrix;
ll pref[2001];
int n, lhs, rhs;
bool valid[2001];
bool nextValid[2001];
bitset<2001> dp[2001];
bool can(ll mask) {
for(int i = 0; i <= n; i++) {
dp[i].reset();
}
dp[0].set(0);
for(int i = 0; i < n; i++) {
for(int j = i+1; j <= n; j++) {
ll vv = pref[j] - pref[i];
if((vv&mask)!=vv) continue;
dp[j] |= (dp[i] << 1);
}
}
for(int x = lhs; x <= rhs; x++) {
if(dp[n][x]) return true;
}
return false;
}
int main() {
scanf("%d%d%d", &n, &lhs, &rhs);
for(int i = 0; i < n; i++) {
scanf("%lld", &pref[i+1]);
pref[i+1] += pref[i];
}
ll ret = 1;
while(ret < pref[n]) {
ret |= ret << 1;
}
for(int i = 45; i >= 0; i--) {
ll ans = ret & ~(1LL << (i));
if(ans == ret) continue;
if(can(ans)) {
ret = ans;
}
}
printf("%lld\n", ret);
}
컴파일 시 표준 에러 (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... |