| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 766747 | ivopav | Bali Sculptures (APIO15_sculpture) | C++17 | 1088 ms | 336 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
bool dp(long long int ind,long long int kol,const vector<long long int>& lis,vector<vector<int>>& mem,long long int sad,long long int a,long long int b){
// cout << sad << " " << ind << " " << kol << " " << zbr << "\n";
if (ind==lis.size()){
if (kol<a){
return false;
}
return true;;
}
if (mem[ind][kol]==-1){
return true;
}
if (kol==b){
return false;
}
//long long int najm=dp(ind+1ll,kol,zbr+lis[ind],lis,mem,sad,a,b);
long long int zbr=0ll;
bool najm=false;
for (long long int i=ind;i<lis.size();i++){
zbr+=lis[i];
if ((zbr|sad)==sad){
najm=najm||dp(i+1ll,kol+1ll,lis,mem,sad,a,b);
}
}
mem[ind][kol]=najm;
return najm;
}
int main(){
long long int n;
long long int a;
long long int b;
cin >> n >> a >> b;
vector<long long int> lis={};
for (long long int i=0ll;i<n;i++){
long long int unos;
cin >> unos;
lis.push_back(unos);
}
long long int sad=numeric_limits<long long int>::max();
long long int sadznam=1ll;
for (long long int i=0ll;i<62ll;i++){
sadznam*=2ll;
}
while (sadznam>0){
vector <vector<int>> mem=vector<vector<int>>(n+5ll,vector<int>(b+5ll,0));
if (dp(0ll,0ll,lis,mem,sad-sadznam,a,b)){
sad-=sadznam;
}
sadznam/=2ll;
}
cout << sad << "\n";
}컴파일 시 표준 에러 (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... | ||||
