| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 283410 | keta_tsimakuridze | Bank (IZhO14_bank) | C++14 | 1089 ms | 103160 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int n,m,a[25],B[25],dp[2000006][25],i,j,k,s;
vector<int>V[25];
bool go(int b,int i){
if(i==n) {
return 1;
}
bool F=0;
if(dp[b][i]!=-1) return dp[b][i];
for(int j=0;j<V[i].size();j++){
if((b&V[i][j])==V[i][j]) {
if(i+1==n) return dp[b][i]=1;
F=max(F,go(b^V[i][j],i+1));
}
}
if (!F) {
dp[b][i]=0; return 0;
}
return dp[b][i]=1;
}
int main(){
cin>>n>>m;
for(k=0;k<n;k++){
cin>>a[k];
}
for(k=0;k<m;k++)
cin>>B[k];
for(k=0;k<n;k++){
s=0;
for(i=0;i< (1<<m); i++){
s=0; dp[i][k]=-1;
for(int j=0;j<=m;j++){
int b=1<<j;
if(b&i)s+=B[j];
}
if(s==a[k]) V[k].push_back(i);
}
}int b=1<<(m);
if(go(b-1,0))cout<<"YES";
else cout<<"NO";
}컴파일 시 표준 에러 (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... | ||||
