| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 243329 | Leonardo_Paes | Bali Sculptures (APIO15_sculpture) | C++17 | 295 ms | 512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline bool check(ll a, ll b){
return ((a&b) == a);
}
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n, a, b;
cin >> n >> a >> b;
vector<int> v(n+1);
for(int i=1; i<=n; i++) cin >> v[i];
if(a == 1){
vector<int> dp(n+1); // least k | it is possible to divide in k subarrays
ll mask = ~(1LL<<63);
for(int i=62; i>=0; i--){
dp[0] = 0;
for(int x=1; x<=n; x++) dp[x] = n+1;
for(int x=1; x<=n; x++){
ll sum = 0;
for(int y=x; y>=1; y--){
sum += v[y];
if(check(sum, mask^(1LL<<i))) dp[x] = min(dp[x], 1 + dp[y-1]);
}
}
if(dp[n] <= b) mask ^= (1LL<<i);
}
cout << mask << "\n";
}
else{
}
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... | ||||
