| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 284406 | doowey | Bali Sculptures (APIO15_sculpture) | C++14 | 1065 ms | 1016 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int N = 2005;
bitset<N>dp[N];
ll A[N];
int main(){
fastIO;
int n, a, b;
cin >> n >> a >> b;
for(int i = 1; i <= n; i ++ ){
cin >> A[i];
}
ll xf = 0;
ll nw;
ll sigma;
ll answ = 0;
bool res;
for(int lg = 40; lg >= 0; lg -- ){
nw = xf;
nw |= (1ll << lg);
for(int i = 0; i <= n; i ++ ){
for(int j = 0 ; j <= n; j ++ ){
dp[i][j]=0;
}
}
dp[0][0]=1;
for(int i = 1; i <= n; i ++ ){
sigma = 0;
for(int j = i; j > 0 ; j -- ){
sigma += A[j];
if((sigma & nw) > 0) continue;
dp[i] |= (dp[j-1] << 1);
}
}
res=false;
for(int k = a; k <= b; k ++ ){
if(dp[n][k]) res=true;
}
if(res){
xf = nw;
}
else{
answ |= (1ll << lg);
}
}
cout << answ << "\n";
return 0;
}
| # | 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... | ||||
