답안 #668912

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
668912 2022-12-05T07:34:42 Z irmuun 은행 (IZhO14_bank) C++17
0 / 100
1 ms 300 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int main(){
    int n,m;
    cin>>n>>m;
    int a[n+5],b[m+5];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<m;i++){
        cin>>b[i];
    }
    int dp[1000*m+5];
    fill(dp,dp+1000*m+1,0);
    for(int i=0;i<(1<<m);i++){
        int cur=i;
        int res=1;
        for(int j=0;j<m;j++){
            if(cur%2==1){
                res+=b[j];
            }
            cur/=2;
        }
        dp[res]=1;
    }
    bool ok=true;
    for(int i=0;i<n;i++){
        if(dp[a[i]]==0){
            ok=false;
            break;
        }
    }
    if(ok==true){
        cout<<"YES";
    }
    else{
        cout<<"NO";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 300 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -