# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
284408 | doowey | Bali Sculptures (APIO15_sculpture) | C++14 | 109 ms | 512 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;
int dp[N][2];
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 ++ ){
dp[i][0]=(int)1e9;
dp[i][1]=-(int)1e9;
}
dp[0][0]=0;
dp[0][1]=0;
for(int i = 1; i <= n; i ++ ){
sigma = 0;
for(int j = i; j > 0; j -- ){
sigma += A[j];
if((sigma & nw)) continue;
dp[i][0]=min(dp[i][0],dp[j-1][0]+1);
dp[i][1]=max(dp[i][1],dp[j-1][1]+1);
}
}
if(dp[n][0] > b || dp[n][1] < a){
answ |= (1ll << lg);
}
else{
xf = nw;
}
}
cout << answ << "\n";
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... |