제출 #344675

#제출 시각아이디문제언어결과실행 시간메모리
344675Erzhan06은행 (IZhO14_bank)C++17
46 / 100
1 ms492 KiB
#include <bits/stdc++.h> using namespace std; #define nl "\n" #define bananas return 0; #define ll long long #define IOS ios_base :: sync_with_stdio(NULL); cin.tie(0); cout.tie(0); const int N=2e5+6; const int INF=1e9+6; int main() { IOS ll n,m; cin>>n>>m; ll a[n+1]; ll b[m+1]; for (int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=m;i++) { cin>>b[i]; } ll ans=0; for (int e=1;e<=n;e++) { ll s=a[e]; ll dp[2001]; dp[0]=1; for (int i=1;i<=m;i++) { for (int j=s;j>=0;j--) { if (j>=b[i] && dp[j-b[i]]==1){ dp[j]=1; } } } if (dp[s]!=1) { ans++; } } if (ans==0) { cout<<"YES"; }else { cout<<"NO"; } bananas }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...