| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 736011 | Alihan_8 | Bali Sculptures (APIO15_sculpture) | C++17 | 1089 ms | 3144 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define pb push_back
#define ln '\n'
#define int long long
template <class _T>
bool chmin(_T &x, const _T &y){
bool flag = false;
if ( x > y ){
x = y; flag |= true;
}
return flag;
}
template <class _T>
bool chmax(_T &x, const _T &y){
bool flag = false;
if ( x < y ){
x = y; flag |= true;
}
return flag;
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, a, b; cin >> n >> a >> b;
vector <int> p(n);
for ( auto &i: p ) cin >> i;
const int inf = 1e15 + 1;
vector <int> pref(n + 1);
for ( int i = 0; i < n; i++ ){
pref[i + 1] = pref[i] + p[i];
}
int ans = 0;
for ( int bit = 60; bit >= 0; bit-- ){
vector <vector<int>> dp(n + 1, vector <int> (n + 1));
dp[0][0] = true;
for ( int i = 1; i <= n; i++ ){
for ( int j = 1; j <= i; j++ ){
for ( int k = 0; k + 1 <= i; k++ ){
if ( !dp[k][j - 1] ) continue;
int v = (pref[i] - pref[k]) >> bit;
if ( ((v | ans) ^ ans) == false ){
dp[i][j] = true;
break;
}
}
}
}
bool flag = false;
for ( int i = a; i <= b; i++ ){
flag |= dp[n][i];
}
ans = (ans + !flag) << 1;
}
cout << ans / 2;
cout << '\n';
}
/*
6 1 3
8 1 2 1 5 4
*/
컴파일 시 표준 에러 (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... | ||||
